简体   繁体   English

使用 Alembic 创建数据库

[英]Create database using Alembic

I have database migrations that use database1 .我有使用database1的数据库迁移。 I'm using it for Alembic for migrations.我将它用于 Alembic 进行迁移。

How do I create a database database1 before running alembic?如何在运行 alembic 之前创建数据库database1

I've created a database infrastructure using CloudFormation.我已经使用 CloudFormation 创建了一个数据库基础架构。 And when we run the first migration, I need to run SQL create database database1 or something equivalent.当我们运行第一次迁移时,我需要运行 SQL create database database1或类似的东西。

I ended up using @SuperShoot's advice.我最终使用了@SuperShoot 的建议。 I modified my CFT to include below snipppet我修改了我的 CFT 以包含以下代码段

  "Parameters": {
    "DBName": {
      "Default": "<database name>",
      "Description": "The database name",
      "Type": "String",
      ...
    },
    ...
  }, 
  "Resources": {
   "RDSinstance": {
      "Type": "AWS::RDS::DBInstance",
      "Properties": {
        "DBName": {
          "Ref": "DBName"
        },
        ...
      }
    }, 
    ...
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM