Skip to content

change sqlite {property,environ}.val to TEXT type #56

@kybin

Description

@kybin

I've used the columns as STRING. but it turns that STRING is not a thing in sqlite and it will convert the input value with some rules. I noticed it translates some of my inputs to INTEGER. I want to keep them as I saved. Need to change them as TEXT.

BEGIN TRANSACTION;

CREATE TABLE tmp_properties (id INTEGER PRIMARY KEY, entry_id INTEGER, default_id INTEGER NOT NULL, val TEXT NOT NULL, updated_at TIMESTAMP NOT NULL, FOREIGN KEY (entry_id) REFERENCES entries (id), FOREIGN KEY (default_id) REFERENCES default_properties (id), UNIQUE (entry_id, default_id));
INSERT INTO tmp_properties SELECT id, entry_id, default_id, val, updated_at FROM properties;
DROP TABLE properties;
ALTER TABLE tmp_properties RENAME TO properties;

CREATE TABLE tmp_environs (id INTEGER PRIMARY KEY, entry_id INTEGER, name STRING NOT NULL, typ STRING NOT NULL, val TEXT NOT NULL, updated_at TIMESTAMP NOT NULL, FOREIGN KEY (entry_id) REFERENCES entries (id), UNIQUE (entry_id, name));
INSERT INTO tmp_environs SELECT id, entry_id, name, typ, val, updated_at FROM environs;
DROP TABLE environs;
ALTER TABLE tmp_environs RENAME TO environs;

COMMIT;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions