Revision 2089
Added by Aaron Marcuse-Kubitza over 12 years ago
Makefile | ||
---|---|---|
157 | 157 |
|
158 | 158 |
#### DB and bien user |
159 | 159 |
|
160 |
confirmRmDb = $(call confirm,WARNING:\ |
|
161 |
This will delete your VegBIEN DB if it exists! Continue?) |
|
160 |
confirmRmDbMsg := WARNING: This will delete your entire VegBIEN DB,\ |
|
161 |
including previous public schema versions and staging tables! Continue? |
|
162 |
confirmRmDb = $(call confirm,$(confirmRmDbMsg)) |
|
163 |
|
|
164 |
confirmRmPublicSchemaMsg := WARNING: This will delete the current public\ |
|
165 |
schema of your VegBIEN DB! (To save it, use \`make schemas/rotate\`.) Continue? |
|
166 |
confirmRmPublicSchema = $(call confirm,$(confirmRmPublicSchemaMsg)) |
|
167 |
|
|
162 | 168 |
rmPublicSchema := 'DROP SCHEMA IF EXISTS public CASCADE;' |
163 | 169 |
|
164 | 170 |
db: mk_db schemas/install _always ; |
165 | 171 |
|
166 | 172 |
mk_db: _always |
167 |
@$(confirmRmDb) |
|
168 | 173 |
-echo "CREATE USER bien PASSWORD '$(bienPassword)';"|$(psqlAsAdmin) |
169 | 174 |
-echo "CREATE DATABASE vegbien WITH OWNER bien TEMPLATE template1 \ |
170 | 175 |
ENCODING 'UTF8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';"|$(psqlAsAdmin) |
176 |
@$(confirmRmPublicSchema) |
|
171 | 177 |
echo $(rmPublicSchema)|$(psqlAsAdmin) vegbien |
172 | 178 |
# ignore errors if user or database exists |
173 | 179 |
# drop public schema *as admin* because it starts out owned by postgres |
... | ... | |
188 | 194 |
# public schema will be owned by bien |
189 | 195 |
|
190 | 196 |
schemas/uninstall: _always |
191 |
@$(confirmRmDb)
|
|
197 |
@$(confirmRmPublicSchema)
|
|
192 | 198 |
echo $(rmPublicSchema)|$(psqlAsBien) |
193 | 199 |
|
194 | 200 |
schemas/rotate: _always schemas/rotate-only schemas/install ; |
... | ... | |
196 | 202 |
echo 'ALTER SCHEMA public RENAME TO "public.$(date)";'|$(psqlAsBien) |
197 | 203 |
|
198 | 204 |
empty_db: _always schemas/vegbien_empty.sql |
199 |
@$(confirmRmDb)
|
|
205 |
@$(confirmRmPublicSchema)
|
|
200 | 206 |
$(psqlAsBien) <schemas/vegbien_empty.sql |
201 | 207 |
|
202 | 208 |
##### MySQL |
Also available in: Unified diff
Makefile: VegBIEN DB: Display different warning message depending on whether entire DB or just current public schema is being deleted