SQL

CREATE TABLE "Order"  (
  "id" integer PRIMARY KEY,
  "user_id" integer NOT NULL REFERENCES "User" ("id"),
  "shipping_address_id" integer REFERENCES "ShippingAddress" ("id"),
  "project_id" integer NOT NULL,
  "status" text NOT NULL,
  "payment_method" text NOT NULL,
  "provider" text NOT NULL,
  "order_subtotal" integer NOT NULL,
  "order_shipping_total" integer NOT NULL,
  "order_total" integer NOT NULL,
  "order_total_with_fees" integer NOT NULL,
  "service_fee" integer NOT NULL,
  "shipping_type" text NOT NULL,
  "refunded" integer NOT NULL,
  "is_cancellable" integer NOT NULL,
  "created_at" text NOT NULL,
  "labeled" integer NOT NULL DEFAULT FALSE,
  "packed" integer NOT NULL DEFAULT FALSE,
  "sent" integer NOT NULL DEFAULT FALSE,
  "problem" integer NOT NULL DEFAULT FALSE,
  "notes" text NOT NULL DEFAULT '',
  "support" text NOT NULL DEFAULT ''
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
user_id INTEGER Rename | Drop
shipping_address_id INTEGER Rename | Drop
project_id INTEGER Rename | Drop
status TEXT Rename | Drop
payment_method TEXT Rename | Drop
provider TEXT Rename | Drop
order_subtotal INTEGER Rename | Drop
order_shipping_total INTEGER Rename | Drop
order_total INTEGER Rename | Drop
order_total_with_fees INTEGER Rename | Drop
service_fee INTEGER Rename | Drop
shipping_type TEXT Rename | Drop
refunded INTEGER Rename | Drop
is_cancellable INTEGER Rename | Drop
created_at TEXT Rename | Drop
labeled INTEGER Rename | Drop
packed INTEGER Rename | Drop
sent INTEGER Rename | Drop
problem INTEGER Rename | Drop
notes TEXT Rename | Drop
support TEXT Rename | Drop

Foreign Keys

Column Destination
shipping_address_id ShippingAddress.id
user_id User.id

+ Add index

Indexes

Name Columns Unique SQL Drop?