sqlite info – Migration from MySQL

Autoincrement is not prefered.

Autoincrement In SQLite : https://www.sqlite.org/autoinc.html

The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed.

update: this bad definition
CREATE TABLE `baz` (
`id` int(11) NOT NULL ,
`bazoo` varchar(255) NOT NULL,
`status` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’ ,
`updated_at` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
PRIMARY KEY (`id`)
) ;

the good definition:

CREATE TABLE baz (
id INTEGER PRIMARY KEY NOT NULL ,
foo varchar NOT NULL, // OR TEXT

status varchar NOT NULL,
created_at timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’ ,
updated_at timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’

) ;

Create index:
CREATE INDEX bazoo ON baz (bazoo);

Show table info:
PRAGMA table_info(tokens);

Show index info:
PRAGMA index_list(tokens);

SQLite – INDEXES : http://www.tutorialspoint.com/sqlite/sqlite_indexes.htm

Laravel – Setting up the SQLite Database Driver : http://laravel-recipes.com/recipes/118/setting-up-the-sqlite-database-driver

phpliteadmin: https://www.phpliteadmin.org/

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress

Translate »