forked from bigbluebutton/bigbluebutton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bigbluebutton#14786 from paultrudel/recording-api-…
…changes
- Loading branch information
Showing
35 changed files
with
3,679 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POSTGRES_VERSION=14.1 | ||
POSTGRES_USER=bbb | ||
POSTGRES_PASSWORD=bbb123 | ||
HOST_PORT=5432 | ||
CONTAINER_PORT=5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker rm -f $(docker ps -aq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: '2' | ||
|
||
services: | ||
postgres: | ||
image: postgres:${POSTGRES_VERSION} | ||
container_name: postgres | ||
environment: | ||
- "TZ=UTC" | ||
- "POSTGRES_USER=${POSTGRES_USER}" | ||
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}" | ||
ports: | ||
- "${HOST_PORT}:${CONTAINER_PORT}" | ||
volumes: | ||
- "./src/main/java/db/migration:/docker-entrypoint-initdb.d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
. .env | ||
mkdir -p ./src/main/resources | ||
echo '<!DOCTYPE hibernate-configuration PUBLIC | ||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" | ||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> | ||
<hibernate-configuration> | ||
<session-factory> | ||
<!-- JDBC Database connection settings --> | ||
<property name="connection.driver_class">org.postgresql.Driver</property> | ||
<property name="connection.url">jdbc:postgresql://localhost:'"$HOST_PORT"'/bbb</property> | ||
<property name="connection.username">'"$POSTGRES_USER"'</property> | ||
<property name="connection.password">'"$POSTGRES_PASSWORD"'</property> | ||
<!-- JDBC connection pool settings --> | ||
<property name="hibernate.connection.provider_class">com.zaxxer.hikari.hibernate.HikariConnectionProvider</property> | ||
<property name="hibernate.hikari.minimumIdle">5</property> | ||
<property name="hibernate.hikari.maximumPoolSize">10</property> | ||
<property name="hibernate.hikari.idleTimeout">30000</property> | ||
<!-- Select our SQL dialect --> | ||
<property name="dialect">org.hibernate.dialect.PostgreSQL10Dialect</property> | ||
<!-- Echo the SQL to stdout --> | ||
<property name="show_sql">true</property> | ||
<!-- Set the current session context --> | ||
<property name="current_session_context_class">thread</property> | ||
<property name="hibernate.show_sql">false</property> | ||
<!-- format the sql nice --> | ||
<property name="hibernate.format_sql">false</property> | ||
<!-- show the hql as comment --> | ||
<property name="use_sql_comments">false</property> | ||
</session-factory> | ||
</hibernate-configuration>' > ./src/main/resources/hibernate.cfg.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
. .env | ||
echo "================== Help for psql =========================" | ||
echo "\\dt : Describe the current database" | ||
echo "\\d [table] : Describe a table" | ||
echo "\\c : Connect to a database" | ||
echo "\\h : help with SQL commands" | ||
echo "\\? : help with psql commands" | ||
echo "\\q : quit" | ||
echo "Reset the database using the truncate_tables('$POSTGRES_USER') function" | ||
echo "==================================================================" | ||
docker exec -it postgres psql -U $POSTGRES_USER -d bbb |
75 changes: 75 additions & 0 deletions
75
bbb-common-web/src/main/java/db/migration/V1__Initial_create.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
CREATE DATABASE bbb; | ||
\c bbb; | ||
|
||
CREATE TABLE IF NOT EXISTS recordings ( | ||
id BIGSERIAL PRIMARY KEY, | ||
record_id VARCHAR(64), | ||
meeting_id VARCHAR(256), | ||
name VARCHAR(256), | ||
published BOOLEAN, | ||
participants INT, | ||
state VARCHAR(256), | ||
start_time timestamp, | ||
end_time timestamp, | ||
deleted_at timestamp, | ||
publish_updated BOOLEAN DEFAULT FALSE, | ||
protected BOOLEAN | ||
); | ||
CREATE UNIQUE INDEX index_recording_on_recording_id ON recordings (record_id); | ||
CREATE INDEX index_recordings_on_meeting_id ON recordings(meeting_id); | ||
|
||
CREATE TABLE IF NOT EXISTS metadata ( | ||
id BIGSERIAL PRIMARY KEY, | ||
recording_id BIGINT, | ||
key VARCHAR(256), | ||
value VARCHAR(256), | ||
CONSTRAINT fk_metadata_recording FOREIGN KEY(recording_id) REFERENCES recordings(id) | ||
); | ||
CREATE UNIQUE INDEX index_metadata_on_recording_id_and_key ON metadata(recording_id, key); | ||
|
||
CREATE TABLE IF NOT EXISTS playback_formats ( | ||
id BIGSERIAL PRIMARY KEY, | ||
recording_id BIGINT, | ||
format VARCHAR(64), | ||
url VARCHAR(256), | ||
length INT, | ||
processing_time INT, | ||
CONSTRAINT fk_playback_formats_recording FOREIGN KEY (recording_id) REFERENCES recordings(id) | ||
); | ||
CREATE UNIQUE INDEX index_playback_formats_on_recording_id_and_format ON playback_formats(recording_id, format); | ||
|
||
|
||
CREATE TABLE IF NOT EXISTS thumbnails ( | ||
id BIGSERIAL PRIMARY KEY, | ||
playback_format_id BIGINT, | ||
height INT, | ||
width INT, | ||
alt VARCHAR(256), | ||
url VARCHAR(256), | ||
sequence INT, | ||
CONSTRAINT fk_thumbnails_playback_formats FOREIGN KEY (playback_format_id) REFERENCES playback_formats(id) | ||
); | ||
CREATE INDEX index_thumbnails_on_playback_format_id ON thumbnails(playback_format_id); | ||
|
||
|
||
CREATE TABLE IF NOT EXISTS callback_data ( | ||
id BIGSERIAL PRIMARY KEY, | ||
recording_id BIGINT, | ||
meeting_id VARCHAR(256), | ||
callback_attributes TEXT, | ||
created_at timestamp NOT NULL, | ||
updated_at timestamp NOT NULL, | ||
CONSTRAINT fk_callback_data_recordings FOREIGN KEY (recording_id) REFERENCES recordings(id) | ||
); | ||
|
||
CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$ | ||
DECLARE | ||
statements CURSOR FOR | ||
SELECT tablename FROM pg_tables | ||
WHERE tableowner = username AND schemaname = 'public'; | ||
BEGIN | ||
FOR stmt IN statements LOOP | ||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;'; | ||
END LOOP; | ||
END; | ||
$$ LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.