SQLite CREATE TABLE IF NOT EXISTS: What It Skips

CREATE TABLE IF NOT EXISTS creates the table only when no table of that name exists, and otherwise does nothing without an error.

It checks only the name: a changed column list is silently ignored, so new columns never appear.

Change an existing table with ALTER TABLE, and track migrations with PRAGMA user_version.

Add STRICT to enforce column types, and run PRAGMA foreign_keys=ON on every connection.

A new .db file is created on first use; a 0-byte file is a valid empty database.

Read the full post

Read the full post