Articles tagged with "database"
Easy peasy database config
Like a lot of developers out there, I use Subversion to keep control of my code and projects, and I also use a different database for development and production. But when using Cake this can be a problem when checking out my code from development to production. Unless I edit my database.php with my production config, the production code would have problems, as it would be trying to access data from the development database.
What I needed was an easy-peasy way of being able to check in my code to production without having to edit the database.php config file. So what I did was very simple and can be found below.
For a full write up of this trick and other Cake stuff, please see my Blog at http://joelmoss.info
[Read more] What I needed was an easy-peasy way of being able to check in my code to production without having to edit the database.php config file. So what I did was very simple and can be found below.
For a full write up of this trick and other Cake stuff, please see my Blog at http://joelmoss.info
Cake DB Migrations v3.2
This article may be a little outdated. For the latest version and more info, please go to http://developingwithstyle.com
Cake DB Migrations has now been updated to work with the very latest version of CakePHP 1.2 and the new (hopefully final) console/shells system. I have also added a few extra goodies to make life a little easier.
The new features and changes are as follows:
* You can now specify a column without the need to specify the column type. Type is set to string, which is simply a varchar(255) column.
* Ability to add user definable foreign keys by simply specifying the 'fkey' as a column name, followed by the name(s) of the foreign key(s).
* You can now include PHP code within the YAML migration files
Because the console system in Cake 1.2 has changed a bit, ou now have to place the below script in a slightly different place. Within your main 'vendors' directory above your app and cake core directories, paste the below code into a file called 'migrate.php' and place that file in a directory called 'shells'.
Now just bring up your favourite command line tool and cd into your cake applications root directory and run the following:
./cake migrate
And that is it! That will migrate to the lastest version. You can specify the version like this:
./cake migrate -v 3
As promised, I hope to create a screencast going through all aspects of migrations and how they can save your life.
[Read more] Cake DB Migrations has now been updated to work with the very latest version of CakePHP 1.2 and the new (hopefully final) console/shells system. I have also added a few extra goodies to make life a little easier.
The new features and changes are as follows:
* You can now specify a column without the need to specify the column type. Type is set to string, which is simply a varchar(255) column.
* Ability to add user definable foreign keys by simply specifying the 'fkey' as a column name, followed by the name(s) of the foreign key(s).
* You can now include PHP code within the YAML migration files
Because the console system in Cake 1.2 has changed a bit, ou now have to place the below script in a slightly different place. Within your main 'vendors' directory above your app and cake core directories, paste the below code into a file called 'migrate.php' and place that file in a directory called 'shells'.
Now just bring up your favourite command line tool and cd into your cake applications root directory and run the following:
./cake migrate
And that is it! That will migrate to the lastest version. You can specify the version like this:
./cake migrate -v 3
As promised, I hope to create a screencast going through all aspects of migrations and how they can save your life.
ConfComponent DB based configuration
DB based configuration, allows you to set and retrieve values organized into conf categories. Now with caching.
[Read more] ConfComponent DB based configuration Tutorial
ConfComponent allows you to store your configuration into the db, set and retrieve values organized into categories very easily.Now with caching.
changelog
=========
0.9.1:
- Added the ability to call the component in beforeFilter().
0.9:
- Added file caching to minimize db hits.
- Added default value for get()
- Changed the way you set and get values to be more cake-ish
- Introducing $getEmpty
- Introducing some options to deal with boolean values stored as 'true' and 'false'.
- Added setCat to set a category of configs at once
- Added setBatch to save a set of categories with their configs at once
[Read more] changelog
=========
0.9.1:
- Added the ability to call the component in beforeFilter().
0.9:
- Added file caching to minimize db hits.
- Added default value for get()
- Changed the way you set and get values to be more cake-ish
- Introducing $getEmpty
- Introducing some options to deal with boolean values stored as 'true' and 'false'.
- Added setCat to set a category of configs at once
- Added setBatch to save a set of categories with their configs at once
Database design and CakePHP
To start with a CakePHP application you first need a proper database. This database will determine for a great part the structure of your application, with the data layer (Model layer) in particular. This article contains a way to a structured database and data layer for a CakePHP application from a conceptual point of view.
[Read more]
Latest Comments