Logo
Quick Create a Web-Application from Existing Database

Quick Create a Web-Application from Existing Database

About Abris

Aleksey Novikov

Oct 21, 2020

Create the web-based information system from Adventure Works database with free Abris Platform

Abris Platform is really good to create a back-end for your database. While the front-end is pretty simple the back-end can be more complicated because of many tables that you need to edit. For every table you need to create a display page, edit form and write some server code to retrieve and save data. It is a long and boring job.

You can be surprised, but your database contains almost all information to create the interface automatically. Abris Platform can do it for you.

First of all we need to get free version of Abris Platform. We will use docker container with pre-installed Apache+PHP+PostgreSQL+Abris. So open your command line prompt and type the commands (Docker should be installed already):

docker pull abrissite/abris-free
docker run --name abris -it -p 80:80 -p 5432:5432 abrissite/abris-free

The next step is to create a database. You can restore it from dump or backup, or use the SQL script or any other way you like. For example we use a famous demo database created by Microsoft and often used for demonstrations. It is Adventure Works that is looks like this:

This schema is not available now from the Microsoft web-site, we took it from Improve & Repeat blog

We can see that this database is complicated and contains more than 60 tables.

Originally this database was created for Microsoft SQL Server, but there is a version converted for PostgreSQL.

It does not contain data, so we will need to download it from the Microsoft Repo

https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works/oltp-install-script

Now we are inside the docker container that we just created. We need to install Ruby. It is required for script that converts some MS SQL Server sample data to PostgreSQL.

apt install ruby

Then download database scripts, sample data and create database.

Download and unpack database schema:

curl --output adv.zip --location "https://github.com/lorint/AdventureWorks-for-Postgres/archive/master.zip"
unzip adv.zip

Download and unpack sample data:

curl --output adv-sample.zip --location "https://github.com/microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks-oltp-install-script.zip"
unzip adv-sample.zip -d AdventureWorks-for-Postgres-master

Pre-process sample data:

cd AdventureWorks-for-Postgres-master/
ruby update_csvs.rb

Create database and fill it with sample data:

PGPASSWORD=123456 psql --host=localhost --username=postgres -c "create database adventure"
PGPASSWORD=123456 psql --host=localhost --username=postgres --dbname=adventure < install.sql

Then start your browser and go to ardress of your machine where docker runs or just http://localhost/ if docker runs the same machine as your browser.

You can see the installation form and the messages that the configuration does not exist yet.

In the installation form fill default password (123456), database name (adventure), set "Create new database" and "Install demo data" to "No" because database already created, and "Create menu" to "Yes".

Click the "Install" button and then sign in and… that is all!

You see the menu items corresponding to schemas, and sub-items corresponding to tables and views. And now you can browse the data, edit and save it.

You can do this trick with any PostgreSQL database. The main condition is that all tables should be connected with foreign keys constraints. Abris Platform uses information about foreign keys to create an absolutely browsable user interface.

No code, no special design. Just install and use.