#!/usr/bin/env tclsh

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_execsql_test_on_specific_db testing/testing.db schema {
  .schema
} {"CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        first_name TEXT,
        last_name TEXT,
        email TEXT,
        phone_number TEXT,
        address TEXT,
        city TEXT,
        state TEXT,
        zipcode TEXT,
        age INTEGER
    );
CREATE TABLE products (
        id INTEGER PRIMARY KEY,
        name TEXT,
        price REAL
    );
CREATE INDEX age_idx on users (age);"}

# FIXME sqlite does something different with .schema than what we are doing
#do_execsql_test_on_specific_db testing/testing_norowidalias.db schema {
#  .schema
#} {"CREATE TABLE IF NOT EXISTS users (
#        id INT PRIMARY KEY,
#        first_name TEXT,
#        last_name TEXT,
#        email TEXT,
#        phone_number TEXT,
#        address TEXT,
#        city TEXT,
#        state TEXT,
#        zipcode TEXT,
#        age INTEGER
#    );
#CREATE TABLE IF NOT EXISTS products (
#        id INT PRIMARY KEY,
#        name TEXT,
#        price REAL
#    );
#CREATE INDEX age_idx2 on users (age);"}

do_execsql_test_on_specific_db testing/testing.db schema-1 {
  .schema users
} {"CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        first_name TEXT,
        last_name TEXT,
        email TEXT,
        phone_number TEXT,
        address TEXT,
        city TEXT,
        state TEXT,
        zipcode TEXT,
        age INTEGER
    );
CREATE INDEX age_idx on users (age);"}

# FIXME sqlite does something different with .schema than what we are doing
#do_execsql_test_on_specific_db testing/testing_norowidalias.db schema-1 {
#  .schema users
#} {"CREATE TABLE IF NOT EXISTS users (
#       id INT PRIMARY KEY,
#       first_name TEXT,
#       last_name TEXT,
#       email TEXT,
#       phone_number TEXT,
#       address TEXT,
#       city TEXT,
#       state TEXT,
#       zipcode TEXT,
#       age INTEGER
#   );
#CREATE INDEX age_idx2 on users (age);"}

do_execsql_test_on_specific_db testing/testing.db schema-2 {
  .schema products
} {"CREATE TABLE products (
        id INTEGER PRIMARY KEY,
        name TEXT,
        price REAL
    );"}

# FIXME sqlite does something different with .schema than what we are doing
#do_execsql_test_on_specific_db testing/testing_norowidalias.db schema-2 {
#  .schema products
#} {"CREATE TABLE IF NOT EXISTS products (
#        id INT PRIMARY KEY,
#        name TEXT,
#        price REAL
#    );"}

# FIXME sqlite uses multicolumn output mode for display resulting in different spacing
# do_execsql_test_on_specific_db testing/testing.db schema-1 {
#   .tables
# } {"products users"}
