I've a CakePHP 3 application and i want to generate the schema database from the existing models.
I'm new in Cakephp so i want to do a symfony look like command :
php app/console doctrine:schema:update --force
Thank you !
Related
my problem ... i can't migrate from mysql to laravel
i am working on MySQL database and i have a lot of tables i tried to migrate those table to laravel but it doesn't work
my steps was like that:
1-create the table in mysql database
2-opened laravel and write in the .env file the database credentials then i write .. php artisan migrate in the cmd
it says nothing to migrate
all i want is to have the same tables in mysql database to be in my laravel project
There is migrations table in your database which contains the names of the migrations that were already run and exist. So what you need is just to create the database with no tables in it, create your migrations and run php artisan migrate this will run all of your migration files and will create the tables for you.
Can I use MySQL Workbench to create the tables and add data then import / connect that into my Rails app? My Rails app is already connected to MySQL. I am just wondering if I create tables in MySQL Workbench through the app_development schema if that will sync over to my Rails project or not and if there's a way to check to see if it worked?
You can use
rake db:schema:dump
to generate schema.rb from an existing database.
Having schema.rb, you can generate an empty initial migration and put create_table and other statements from generated schema there. Doing this will allow you to use all the relevant rake tasks just as if you developed your database "the Rails way" — via a series of migrations.
I used to utilize
Console/cake schema
in CakePHP 2.
Now I am on my way to CakePHP 3 and find out that Console/cake schema is gone.
So what is the recommended way to manage schema and migrations now?
Lorenzo from the CakePHP core has created the below plugin. It is currently under development and should be considered experimental.
CakePHP 3.0 database migrations plugin
https://github.com/cakephp/migrations
The Migrations Plugin is now part of the CakePHP Core
There are now 2 routes to generate migrations:
Cake (using bake)
bin/cake bake migration [migration_name]
Phinx
bin/cake migrations
Using the Phinx code above it will give you multiple options ie create, migrate, rollback - Create needs a migration name make sure to use CamelCase
How to create a rails 3.1 application using mysql. The following command used to create the project with sqlite database.
rails new depot
I'd like to use mysql then sqlite. So can anyone tell me how to create a project with mysql.
Thanks
See help for rails new command
rails new --help
-d, [--database=DATABASE]
Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
# Default: sqlite3
You should use:
rails new depot -d mysql
I have designed a data model which has almost 24 tables. I have finished specifying the relations and all the data types are finalized. Now, I want to convert it to migrations in Rails.
I have all the scripts ready for it to be created in MySQL. Is there any tool that converts all the table creation queries into a single Rails migration file?
Thanks
I haven't done it myself but according to this post on the ruby forums
rake db:schema:dump
should be sufficient (delete the schema.rb beforehand).
The almost same question here on SO: Ruby / Rails - Reverse Migration - DDL to Ruby Code