Subject: | Schema::Loader does not detect SQLite NOT NULL columns |
BEGIN TRANSACTION;
CREATE TABLE users (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user TEXT UNIQUE NOT NULL,
email TEXT UNIQUE NOT NULL,
password TEXT NOT NULL
);
CREATE TABLE users_to_roles (
user INTEGER NOT NULL,
role INTEGER NOT NULL,
PRIMARY KEY (user, role),
FOREIGN KEY(user) REFERENCES users(id),
FOREIGN KEY(role) REFERENCES roles(id)
);
CREATE TABLE roles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
role TEXT DEFAULT NULL
);
CREATE TABLE configs (
id INTEGER UNIQUE NOT NULL PRIMARY KEY AUTOINCREMENT,
user TEXT UNIQUE NOT NULL,
config TEXT UNIQUE NOT NULL,
added TEXT NOT NULL DEFAULT 'unknown',
FOREIGN KEY(user) REFERENCES users(user)
);
INSERT INTO "users" VALUES(1,'friend','fake@email.com', 'foDCGe8hfTtg.');
INSERT INTO "users" VALUES(2,'neighbor','ab@cd.com', 'baxXrXtQl0c6Y');
INSERT INTO "users_to_roles" VALUES(1,1);
INSERT INTO "roles" VALUES(1,'is_admin');
INSERT INTO "configs" VALUES(1,'friend','[]', 'Sun Apr 19 09:19:04 2009');
INSERT INTO "configs" VALUES(2,'neighbor','$VAR=[]', 'Sun Apr 19
09:19:04 2009');
END TRANSACTION;
~
generates
53
54 __PACKAGE__->add_columns(
55 "id",
56 {
57 data_type => "INTEGER",
58 default_value => undef,
59 is_auto_increment => 1,
60 is_nullable => 0,
61 size => undef,
62 },
63 "user",
64 {
65 data_type => "TEXT",
66 default_value => undef,
67 is_nullable => 1,
68 size => undef,
69 },
70 "email",
71 {
72 data_type => "TEXT",
73 default_value => undef,
74 is_nullable => 1,
75 size => undef,
76 },
77 "password",
78 {
79 data_type => "TEXT",
80 default_value => undef,
81 is_nullable => 1,
82 size => undef,
83 },
84 );
The issue seems to lie in DBIx::Class::Schema::Loader::DBI::SQLite .