File: cli-apply-directory.txt

package info (click to toggle)
golang-ariga-atlas 0.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,676 kB
  • sloc: javascript: 592; sql: 404; makefile: 10
file content (40 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
! atlas schema apply -f empty/ -u URL --auto-approve
stderr 'no schema files found'

atlas schema apply -f schema/ -u URL --auto-approve
cmpshow users expected.sql

atlas schema apply -f schema/ -u URL --auto-approve --dry-run --exclude "*.*.id" > inspected.txt
cmp inspected.txt alter.txt

atlas schema apply -f schema/ -u URL --auto-approve --dry-run --exclude "*.users" > inspected.txt
cmp inspected.txt create.txt

-- schema/users.hcl --
table "users" {
  schema = schema.main
  column "id" {
    null = false
    type = int
  }
  column "status" {
    null = true
    type = text
    default = "hello"
  }
}
-- schema/schema.hcl --
schema "main" {
}
-- empty/hello.txt --
hello, world!
-- expected.sql --
CREATE TABLE `users` (`id` int NOT NULL, `status` text NULL DEFAULT 'hello')
-- alter.txt --
-- Planned Changes:
-- Add column "id" to table: "users"
ALTER TABLE `users` ADD COLUMN `id` int NOT NULL
-- create.txt --
-- Planned Changes:
-- Create "users" table
CREATE TABLE `users` (`id` int NOT NULL, `status` text NULL DEFAULT 'hello')