In this parameter, we can also define the unique and primary key constraint at that time of table creation and it created the internal index with name. Name: Name means column store name of object. The type we can represent as sqlite_schema.type. Type: SQLite type means text string such as table, view, index, or trigger as that depends on which type of object we defined. Schema uses the different parameters as follows. The above-mentioned second and third alternatives are only used for the temp database and are associated with each and every database connection. As well as it has some alternative names as follows. Sqlite_schema is basically used as a reference for the schema table and it is granted by the name is main.sqlite_schema. Database uses the schema and is a depiction of the entirety of different tables, lists, triggers, and views that are contained inside the database. This is one of the commands to describe the table that is sqlite_master.Įach SQLite database has a solitary “schema table” that holds the schema for that database. The only difference is that it also returns the hidden column that specified the virtual table. This statement is the same as the above statement. At the AFTER time, the dbversion has already been increased.This command is equivalent to the SQL describe command, this command returns the single row from every column from the specified table. The AFTER event is only triggered after the migration file has been applied or the BEFORE event set a truish result. The BEFORE event can optionally change the file attribute of the data to load a different file. When the result is false, the migration process is aborted. When an event prevents the default, the proper $event→result has to be set! When the result is true, the dbversion is increased and any additional migrations are run. The default action is to apply that file and increase the dbversion field in the opts table. The BEFORE event is executed before the migration file is applied. Public function handle_migrations (Doku_Event $event, $param ) You can verify the name of the database being upgraded like that: sql, // the associated update file 'sqlite' => $this // the initialized sqlite plugin instance for this database ) $data = array ( 'from' => 5, // previous version 'to' => 6, // version this migration migrates to 'file' => /some /path /to /plugin /db /update0006. Also check that you are only handling your own database upgrade. This makes it possible to do more complex migrations that require more than just SQL. This event is triggered when any new migration (see above) is applied. You may not have a table named like that! The sqlite plugin keeps track of the version a database is in currently using a table called opts. If an update fails, the transaction is rolled back and the update is aborted. The update mechanism will wrap the execution of each update in a transaction, you need not to do that yourself. The update files it self have to be named updateXXXX.sql where XXXX is a zero-padded 4 digit number, starting with 0001. The number of the most recent version has to be stored in a file called latest.version. Each subsequent version is then applied above the previous version. Version 1 is the very first setup that is done when the database is created. Each file correspondents to a certain database version. The second parameter has to point to a directory where your SQL files are located. This is all handled within the init() function. The sqlite plugin provides a simple mechanism to do so. When you release new versions of your plugin you might need to update the schema. Your plugin will need to create a database schema and maybe fill it with some initial data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |