Skip to content

Commit

Permalink
DBIC Generation Support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaitlyn Parkhurst committed Oct 9, 2021
1 parent 35eee5f commit 5243938
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions DB/bin/create-classes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

CLASS_NAME="BlogDB::DB"

# Generate a random 8 character name for the docker container that holds the PSQL
# database.
PSQL_NAME=$(cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z' | fold -w 8 | head -n 1)

# Launch a PSQL Instance
PSQL_DOCKER=`docker run --rm --name $PSQL_NAME -e POSTGRES_PASSWORD=dbic -e POSTGRES_USER=dbic -e POSTGRES_DB=dbic -d \
--mount type=bind,src=$PWD/etc/schema.sql,dst=/docker-entrypoint-initdb.d/schema.sql postgres:11`

docker run --rm --link $PSQL_NAME:psqldb --mount type=bind,src=$PWD,dst=/app symkat/schema_builder /bin/build-schema $CLASS_NAME

docker kill $PSQL_DOCKER

sudo chown -R $USER:$USER lib
20 changes: 20 additions & 0 deletions DB/dist.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name = BlogDB-DB
author = Kaitlyn Parkhurst <symkat@symkat.com>
license = Perl_5
copyright_holder = Kaitlyn Parkhurst
copyright_year = 2021
abstract = BlogDB's Database
version = 1
[@Basic]
[Prereqs]
DBIx::Class::InflateColumn::Serializer = 0
DBIx::Class::Schema::Config = 0
DBIx::Class::DeploymentHandler = 0
MooseX::AttributeShortcuts = 0
MooseX::Getopt = 0
Data::GUID = 0
DBD::Pg = 0
[AutoPrereqs]

0 comments on commit 5243938

Please sign in to comment.