sqlite
Parse error: near “autoincrement”: syntax error – SQLite
According to SQLite FAQ you have to declare either a INTEGER PRIMARY KEY or INTEGER PRIMARY KEY AUTOINCREMENT column to achieve that.
Non-interactive SQLite3 usage from bash script
Looks like it’s as simple as #!/bin/bash sqlite3 test.db “create table n (id INTEGER PRIMARY KEY,f TEXT,l TEXT);” sqlite3 test.db “insert into n (f,l) values (‘john’,’smith’);” sqlite3 test.db “select * from n;” from https://mailliststock.wordpress.com/2007/03/01/sqlite-examples-with-bash-perl-and-python/
SQLite with skip (offset) only (not limit)
Just set LIMIT to -1. For example: SELECT * FROM table LIMIT -1 OFFSET 10
Django: What are the best practices to migrate a project from sqlite to PostgreSQL
In my experience, dumping & restoring from SQL doesn’t work properly. You should follow this sequence instead: 1. Dump db contents to json $ ./manage.py dumpdata > dump.json 2. Switch the backend in settings.py DATABASES = { # COMMENT OUT: # ‘default’: dj_database_url.config(default=”sqlite:////full/path/to/your/database/file.sqlite”), # ADD THIS INSTEAD: ‘default’: dj_database_url.config(default=”postgres://localhost:5432/postgres_db_name”), } 3. Syncdb and migrate the … Read more
Laravel migration with SQLite ‘Cannot add a NOT NULL column with default value NULL’
It looks like this is a SQLite oddity. According to a Laracast forum thread about the same issue: When adding a table from scratch, you can specify NOT NULL. However, you can’t do this when adding a column. SQLite’s specification says you have to have a default for this, which is a poor choice. Looking … Read more