GithubHelp home page GithubHelp logo

rpiaggio / gsp-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gemini-hlsw/gsp-core

0.0 1.0 0.0 537 KB

Core schema and data model for GSP.

Scala 86.29% TSQL 13.12% PLpgSQL 0.43% Shell 0.16%

gsp-core's Introduction

gsp-core

Core schema and data model for GSP.

Artifact Platform(s) Description
gsp-core-model JVM+JS, Scala 2.12 GSP core data model.
gsp-core-testkit JVM+JS, Scala 2.12 GSP core laws and arbitraries.
gsp-core-ocs2-api JVM+JS, Scala 2.12 OCS2 PIO parsers for GSP core data model.

In addition, this library builds and tests (but does not publish) core database bindings, epheris parsing, and OCS2 program import functionality. These modules will be moved into application projects as GSP progresses.

Setting Up a Local Database

In order to build and run tests you will need a Postgres database running locally. There are two ways to do this.

Option 1: Postgres in Docker

This option is what's used in CI and is what you want if you're ok starting over with an empty database when things change. It does not require you to install or administer your own Postgres instance. Make sure you have Docker installed, then you can use the included docker-compose file. In the project root run:

docker-compose up -d

This will start a new Postgres database initialized with the schema defined in the schema project, configured as follows.

Parameter Value Notes
Port 5432 This is the standard port.
Database gem
User postgres
Password (none)

If you have psql installed locally you can connect to the database thus:

psql -h localhost -U postgres -d gem

Otherwise you can run it in a container:

docker-compose exec db psql -U postgres -d gem

To stop and delete the database:

docker-compose down

Option 2: Local Postgres Installation with Flyway

If you want to maintain a database full of data and peform migrations instead of starting with a fresh database every time, this option is probably what you want. Install Postgres.app and add its binaries to your path, something along the lines of

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin

Next you can run the following to create the postgres user and gem database.

psql -c 'create user postgres createdb'
psql -c 'create database gem' -U postgres

Initialize the database by running the migration scripts.

sbt schema/flywayMigrate

If you ever want to wipe out the database and start over, you can do

psql -c 'drop database gem' -U postgres

And then redo the steps above starting from create database.

You can do

psql -U postgres -d gem

to poke around with the database on the commandline.

Generating Enumerated Types

There are many enumerated types in the database, represented by tables named e_whatever. The Scala equivalents are generated on demand by queries, then checked into source control like normal source files. This is only needed if you update the contents of an enum in the schema, or add/modify a the generation code in the gen project. In any case, you can [re]-generate the enumerated types thus:

sbt genEnums

The source files appear in modules/model/shared/src/main/scala/gem/enum.

gsp-core's People

Contributors

cquiroz avatar mergify[bot] avatar rpiaggio avatar scala-steward avatar swalker2m avatar tpolecat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.