Skip to content

Add better ddl2cpp test coverage of column types #191

@christianparpart

Description

@christianparpart

This is the file i had in mind:

-- Test mapping of various SQL column types and properties to C++ types.

CREATE TABLE IF NOT EXISTS ColumnTypeTest1 (
    -- primary keys
    integerAutoincrementPK  INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

    -- nullability
    integerNotNull          INTEGER NOT NULL,
    integerNull             INTEGER NULL,

    -- various column types
    tinyIntColumn           TINYINT NULL,
    smallIntColumn          SMALLINT NULL,
    integerColumn           INTEGER NULL,
    bigIntColumn            BIGINT NULL,
    numericColumn           NUMERIC(10, 2) NULL,
    booleanColumn           BOOLEAN NULL,
    dateColumn              DATE NULL,
    timestampColumn         TIMESTAMP NULL,
    datetimeColumn          DATETIME NULL,

    charColumn              CHAR(8) NULL,
    varcharColumn           VARCHAR(30) NULL,
    textColumn              TEXT NULL,
    blobColumn              BLOB NULL,

    binaryColumn            BINARY(16) NULL,
    varBinaryColumn         VARBINARY(16) NULL,

    -- Unicode column types
    nCharColumn             NCHAR(8) NULL,
    nVarCharColumn          NVARCHAR(30) NULL,
    nTextColumn             NTEXT NULL
);

CREATE TABLE IF NOT EXISTS ColumnTypeTest2 (
    -- primary keys
    guidPK                  GUID NOT NULL PRIMARY KEY
);

CREATE TABLE IF NOT EXISTS ColumnTypeTest3 (
    -- primary keys
    varcharPK               VARCHAR(30) NOT NULL PRIMARY KEY
);

@Yaraslaut but now I realize that this is not quite working in the way we're currently doing the tests, because this is SQL dialect dependant, and thus, we cannot run that test on every database, but only on hard-coded SQLite (as done right now).

Some column names and properties may however differ, depending on the dialect. Would it make sense to move the actual logic of ddl2cpp into the core library and then ahve a way to run the tests in C++, using the migration query builder API? 🤔

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions