# |
Aug 29th 2019, 20:09 |
cnizzardini |
or casting the column to DATE() for MySQL |
# |
Aug 29th 2019, 20:09 |
cnizzardini |
I was hoping there is a way of instructing cake to treat it as date field, rather than having to add a ranged search |
# |
Aug 29th 2019, 20:08 |
cnizzardini |
so if I have a record with a created value of '2019-01-01 11:54:32' and I search for created = '2019-01-01' obviously that will not return results |
# |
Aug 29th 2019, 20:05 |
ricksaccous |
are you talking about just displaying the date in that format? |
# |
Aug 29th 2019, 20:05 |
ricksaccous |
i don't understand exactly what you want |
# |
Aug 29th 2019, 20:03 |
cnizzardini |
I understand within the where operation I could probably cast to date with something like DATE(table_name.created) but is there another way to accomplish this? I'd like to avoid updating so much code. |
# |
Aug 29th 2019, 20:03 |
cnizzardini |
How do you tell the Cake ORM to treat a date/time field as a date field when doing like things like table_name.created = '2019-08-01' |
# |
Aug 29th 2019, 19:36 |
admad |
bakers pagination very large table might appreciate this https://github.com/cakephp/cakephp/pull/13572 |
# |
Aug 29th 2019, 18:11 |
sdevore |
Well maybe @bmudda tip will solve your problem for now…. |
# |
Aug 29th 2019, 18:04 |
noel |
I haven't quite figured out how to string them all together in a local env yet. |
# |
Aug 29th 2019, 18:03 |
noel |
I'm deploying to Docker containers but not using them for my local dev env, which is not ideal. |
# |
Aug 29th 2019, 18:02 |
sdevore |
Docker containers. So I kind of solve the whole it works on my machine issue by just having my machine everywhere ;) Mostly I can better replicate client environments with only a little extra overhead |
# |
Aug 29th 2019, 18:02 |
bmudda |
@noel your `phinx.yml` file should look like this if you are using MAMP ``` development: adapter: mysql host: localhost name: your_db_name user: your_db_user pass: 'your_db_password' unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock charset: utf8 ``` |
# |
Aug 29th 2019, 17:59 |
noel |
What do you use instead of MAMP now? |
# |
Aug 29th 2019, 17:58 |
sdevore |
this mamp stuff is from memory so could be *wrong* or *outdated* |
# |
Aug 29th 2019, 17:56 |
sdevore |
it is likely that when running phnix from the command line you are using the system mysql to connect to the db and cake is all running in MAMP so you might need to edit the my.conf for your installed mysql to change where the socket is… `/etc/my.conf` edit the lines ``` [mysqld] socket=/Applications/MAMP/tmp/mysql/mysql.sock [client] socket=/Applications/MAMP/tmp/mysql/mysql.sock ``` |
# |
Aug 29th 2019, 17:54 |
sdevore |
also a 2002 error I think indicates that mysql thinks it is trying to connect via the `/tml/mysql.sock` so you might need to create a soft link to where MAMP puts it… I haven’t used MAMP in a while so not totally sure if that is right, but it could mean that your config is not actually being read |
# |
Aug 29th 2019, 17:52 |
sdevore |
if cake connects I feel pretty safe that migrations can |
# |
Aug 29th 2019, 17:51 |
sdevore |
I create them from migrations as well https://book.cakephp.org/migrations/2.x/en/index.html#creating-a-table |
# |
Aug 29th 2019, 17:51 |
noel |
@sdevore ok so, what? You first create the tables in sql and then use bake migrations to create the migrations from mysql? |
# |
Aug 29th 2019, 17:50 |
sdevore |
@noel for basic migrations you can create them all with `bin/cake bake migrations ...` then you just need to tune them a little bit when made and then just run them. This is nice because then I just have deployer run bin/cake migrations migrate` as part of the push |
# |
Aug 29th 2019, 17:49 |
noel |
but that's 2.x? |
# |
Aug 29th 2019, 17:48 |
sdevore |
https://book.cakephp.org/migrations/2.x/en/index.html#migrations |
# |
Aug 29th 2019, 17:48 |
noel |
@sdevore oh cool.. didn't know about `bin/cake migrations migrate` |
# |
Aug 29th 2019, 17:46 |
sdevore |
I always run the migrations via `bin/cake migrations migrate` so I haven’t tried directly via phinix |
# |
Aug 29th 2019, 17:45 |
sdevore |
@noel make sure that the user connecting to mysql has database access @localhost and/or @% and that you have granted access to the tables. If you are using mamp you should be able to use the tools in that to check your user permissions and granting (used to ship with phpMyAdmin/ Sequel Pro I think. |
# |
Aug 29th 2019, 17:28 |
graziel |
ah sorry i have no idea how to debug mac net issues |
# |
Aug 29th 2019, 17:25 |
noel |
@graziel thanks, I tried that but MAMP is hosting the app on `my-app:8888`, phinx seems happy with that – I don't get the 2002 error but it just hangs; doesn't actually run the migration. |
# |
Aug 29th 2019, 17:18 |
graziel |
try to use 127.0.0.1 instead of localhost |
# |
Aug 29th 2019, 17:18 |
noel |
phinxlog table is also empty |
# |
Aug 29th 2019, 17:16 |
noel |
Seems like if I change the host from `localhost` to the actual application web path (e.g. host: my-app:8888) then it doesn't cause errors and it is able to write the phinxlog table to the database... but it doesn't do any more than that – none of my migrations run and it just hangs. |
# |
Aug 29th 2019, 17:10 |
noel |
I can't seem to get Phinx to connect to my database however. CakePHP is connected to the database and I've used the same credentials in the phinx.yaml file. Here's the error: ``` InvalidArgumentException: There was a problem connecting to the database: SQLSTATE[HY000] [2002] No such file or directory in /Users/me/myproject/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php:127 ``` Any ideas? |
# |
Aug 29th 2019, 16:39 |
noel |
Got it... composer require --dev robmorgan/phinx@0.10.8 |
# |
Aug 29th 2019, 16:36 |
noel |
Any idea how I can resolve this? |
# |
Aug 29th 2019, 16:36 |
slackebot2 |
cakephp/migrations[2.1.1]. ``` |
# |
Aug 29th 2019, 16:36 |
slackebot2 |
satisfiable by robmorgan/phinx[0.10.3, 0.10.5, 0.10.6, 0.10.7, 0.10.8] but these conflict with your requirements or minimum-stability. - cakephp/migrations 2.1.1 requires robmorgan/phinx ~0.10.3 -> satisfiable by robmorgan/phinx[0.10.3, 0.10.5, 0.10.6, 0.10.7, 0.10.8] but these conflict with your requirements or minimum-stability. - Installation request for cakephp/migrations (locked at 2.1.1, required as ^2.0.0) -> satisfiable by |
# |
Aug 29th 2019, 16:36 |
noel |
Hullo all. I'm trying to get going with phinx and migrations. It's giving me errors: ``` Your requirements could not be resolved to an installable set of packages. Problem 1 - cakephp/migrations 2.1.1 requires robmorgan/phinx ~0.10.3 -> satisfiable by robmorgan/phinx[0.10.3, 0.10.5, 0.10.6, 0.10.7, 0.10.8] but these conflict with your requirements or minimum-stability. - cakephp/migrations 2.1.1 requires robmorgan/phinx ~0.10.3 -> |
# |
Aug 29th 2019, 15:47 |
neon1024 |
I knew it! :weary: |
# |
Aug 29th 2019, 15:46 |
steinkel |
it's PHP so it's your thing :P |
# |
Aug 29th 2019, 15:44 |
neon1024 |
Perhaps I could ask my DevOps colleague :P |
# |
Aug 29th 2019, 15:44 |
neon1024 |
Wouldn’t Deployer be a bit more in the DevOps part of the Venn diagram? |