Switch to fixtures for local dev.

This commit is contained in:
Buster "Silver Eagle" Neece 2018-05-04 17:04:30 -05:00
parent fae0a5e991
commit ad312fa94e
80 changed files with 479 additions and 2482 deletions

2
.gitignore vendored
View File

@ -14,7 +14,9 @@ tmp/cache/*---*
app/env.ini
app/.env
/util/fixtures/*
/util/fixtures/**/*
!/util/fixtures/.gitkeep
web/static/yarn-error\.log
# Composer-generated content
/vendor/

View File

@ -0,0 +1,39 @@
<?php
namespace AzuraCast\Console\Command;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SetupFixtures extends \App\Console\Command\CommandAbstract
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('azuracast:setup:fixtures')
->setDescription('Install fixtures for demo / local dev.');
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$loader = new Loader();
$loader->loadFromDirectory(APP_INCLUDE_BASE.'/src/Entity/Fixture');
/** @var EntityManager $em */
$em = $this->di->get(EntityManager::class);
$purger = new ORMPurger($em);
$executor = new ORMExecutor($em, $purger);
$executor->execute($loader->getFixtures());
$output->writeln('Fixtures loaded.');
}
}

View File

@ -10,6 +10,13 @@ use Slim\Container;
*/
class Adapters
{
public const FRONTEND_ICECAST = 'icecast';
public const FRONTEND_SHOUTCAST = 'shoutcast2';
public const FRONTEND_REMOTE = 'remote';
public const BACKEND_LIQUIDSOAP = 'liquidsoap';
public const BACKEND_NONE = 'none';
/** @var ServiceLocator */
protected $adapters;
@ -79,15 +86,15 @@ class Adapters
if ($adapters === null) {
$adapters = [
'icecast' => [
self::FRONTEND_ICECAST => [
'name' => __('Use <b>%s</b> on this server', 'Icecast 2.4'),
'class' => Frontend\Icecast::class,
],
'shoutcast2' => [
self::FRONTEND_SHOUTCAST => [
'name' => __('Use <b>%s</b> on this server', 'SHOUTcast DNAS 2'),
'class' => Frontend\SHOUTcast::class,
],
'remote' => [
self::FRONTEND_REMOTE => [
'name' => __('Connect to a <b>remote radio server</b>'),
'class' => Frontend\Remote::class,
],
@ -101,7 +108,7 @@ class Adapters
}
return [
'default' => 'icecast',
'default' => self::FRONTEND_ICECAST,
'adapters' => $adapters,
];
}
@ -115,11 +122,11 @@ class Adapters
if ($adapters === null) {
$adapters = [
'liquidsoap' => [
self::BACKEND_LIQUIDSOAP => [
'name' => __('Use <b>%s</b> on this server', 'Liquidsoap'),
'class' => Backend\Liquidsoap::class,
],
'none' => [
self::BACKEND_NONE => [
'name' => __('<b>Do not use</b> an AutoDJ service'),
'class' => Backend\None::class,
],
@ -133,7 +140,7 @@ class Adapters
}
return [
'default' => 'liquidsoap',
'default' => self::BACKEND_LIQUIDSOAP,
'adapters' => $adapters,
];
}

View File

@ -0,0 +1,25 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class Role extends AbstractFixture
{
public function load(ObjectManager $em)
{
$admin_role = new Entity\Role;
$admin_role->setName('Super Administrator');
$demo_role = new Entity\Role;
$demo_role->setName('Demo Account');
$em->persist($admin_role);
$em->persist($demo_role);
$em->flush();
$this->addReference('admin_role', $admin_role);
$this->addReference('demo_role', $demo_role);
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class RolePermission extends AbstractFixture implements DependentFixtureInterface
{
public function load(ObjectManager $em)
{
$permissions = [
'admin_role' => [
'administer all',
],
'demo_role' => [
'administer api keys',
'administer stations',
'view administration',
],
];
foreach($permissions as $role_reference => $perm_names) {
/** @var Entity\Role $role */
$role = $this->getReference($role_reference);
foreach($perm_names as $perm_name) {
$rp = new Entity\RolePermission($role);
$rp->setActionName($perm_name);
$em->persist($rp);
}
}
$em->flush();
}
public function getDependencies()
{
return [
Role::class
];
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class Settings extends AbstractFixture
{
public function load(ObjectManager $em)
{
$settings = [
'base_url' => getenv('INIT_BASE_URL') ?? 'docker.local',
'gmaps_api_key' => getenv('INIT_GMAPS_API_KEY') ?? '',
'instance_name' => getenv('INIT_INSTANCE_NAME') ?? 'local test',
'setup_complete' => time(),
'use_radio_proxy' => 1,
];
/** @var Entity\Repository\SettingsRepository $settings_repo */
$settings_repo = $em->getRepository(Entity\Settings::class);
foreach($settings as $setting_key => $setting_value) {
$settings_repo->setSetting($setting_key, $setting_value);
}
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Entity\Fixture;
use AzuraCast\Radio\Adapters;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class Station extends AbstractFixture
{
public function load(ObjectManager $em)
{
$station = new Entity\Station;
$station->setName('AzuraTest Radio');
$station->setDescription('A test radio station.');
$station->setFrontendType(Adapters::FRONTEND_SHOUTCAST);
$station->setBackendType(Adapters::BACKEND_LIQUIDSOAP);
$station->setRadioBaseDir('/var/azuracast/stations/azuratest_radio');
$em->persist($station);
$em->flush();
$this->addReference('station', $station);
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class StationMedia extends AbstractFixture implements DependentFixtureInterface
{
public function load(ObjectManager $em)
{
$music_skeleton_dir = getenv('INIT_MUSIC_PATH');
if (!empty($music_skeleton_dir) && is_dir($music_skeleton_dir)) {
/** @var Entity\Station $station */
$station = $this->getReference('station');
$station_media_dir = $station->getRadioMediaDir();
/** @var Entity\StationPlaylist $playlist */
$playlist = $this->getReference('station_playlist');
/** @var Entity\Repository\SongRepository $song_repo */
$song_repo = $em->getRepository(Entity\Song::class);
$directory = new \RecursiveDirectoryIterator($music_skeleton_dir);
$iterator = new \RecursiveIteratorIterator($directory);
$i = 1;
foreach ($iterator as $file) {
if ($file->isDir()) {
continue;
}
$file_base_name = basename($file->getPathname());
// Copy the file to the station media directory.
copy($file->getPathname(), $station_media_dir . '/' . $file_base_name);
$media_row = new Entity\StationMedia($station, $file_base_name);
$song_info = $media_row->loadFromFile();
if (is_array($song_info)) {
$media_row->setSong($song_repo->getOrCreate($song_info));
}
$em->persist($media_row);
// Add the file to the playlist.
$spm_row = new Entity\StationPlaylistMedia($playlist, $media_row);
$spm_row->setWeight($i);
$em->persist($spm_row);
$i++;
}
}
$em->flush();
}
public function getDependencies()
{
return [
Station::class,
StationPlaylist::class,
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class StationMount extends AbstractFixture implements DependentFixtureInterface
{
public function load(ObjectManager $em)
{
/** @var Entity\Station $station */
$station = $this->getReference('station');
$em->flush();
}
public function getDependencies()
{
return [
Station::class,
StationPlaylist::class,
];
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class StationPlaylist extends AbstractFixture implements DependentFixtureInterface
{
public function load(ObjectManager $em)
{
/** @var Entity\Station $station */
$station = $this->getReference('station');
$playlist = new Entity\StationPlaylist($station);
$playlist->setName('default');
$em->persist($playlist);
$em->flush();
$this->addReference('station_playlist', $playlist);
}
public function getDependencies()
{
return [
Station::class,
];
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Entity\Fixture;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Entity;
class User extends AbstractFixture implements DependentFixtureInterface
{
public function load(ObjectManager $em)
{
$demo_user = new Entity\User;
$demo_user->setEmail('demo@azuracast.com');
$demo_user->setAuthPassword('demo');
$demo_user->setName('AzuraCast Demo User');
$demo_user->getRoles()->add($this->getReference('demo_role'));
$em->persist($demo_user);
$admin_username = getenv('INIT_ADMIN_USERNAME');
$admin_password = getenv('INIT_ADMIN_PASSWORD');
if (!empty($admin_username) && !empty($admin_password)) {
$admin_user = new Entity\User;
$admin_user->setEmail($admin_username);
$admin_user->setName('System Administrator');
$admin_user->setAuthPassword($admin_password);
$admin_user->getRoles()->add($this->getReference('admin_role'));
$em->persist($admin_user);
}
$em->flush();
}
public function getDependencies()
{
return [
Role::class,
];
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
namespace Migration;
namespace Entity\Migration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

View File

@ -29,7 +29,8 @@
"guzzlehttp/oauth-subscriber": "^0.3.0",
"monolog/monolog": "^1.23",
"gettext/gettext": "^4.4",
"cakephp/chronos": "^1.1"
"cakephp/chronos": "^1.1",
"doctrine/data-fixtures": "^1.3"
},
"require-dev": {
"codeception/codeception": "^2.2",
@ -48,7 +49,6 @@
"App\\": "app/src/App",
"AzuraCast\\": "app/src/AzuraCast",
"Entity\\": "app/src/Entity",
"Migration\\": "app/src/Migration",
"Controller\\": "app/src/Controller"
}
},

68
composer.lock generated
View File

@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c5cd2b045058680a568e07ad6779184f",
"content-hash": "feeae2a7fb9556b1199f25d1ca393320",
"packages": [
{
"name": "azuracast/azuraforms",
@ -473,6 +473,66 @@
],
"time": "2017-08-31T08:43:38+00:00"
},
{
"name": "doctrine/data-fixtures",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/data-fixtures.git",
"reference": "3a1e2c3c600e615a2dffe56d4ca0875cc5233e0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/3a1e2c3c600e615a2dffe56d4ca0875cc5233e0a",
"reference": "3a1e2c3c600e615a2dffe56d4ca0875cc5233e0a",
"shasum": ""
},
"require": {
"doctrine/common": "~2.2",
"php": "^7.1"
},
"conflict": {
"doctrine/phpcr-odm": "<1.3.0"
},
"require-dev": {
"doctrine/dbal": "^2.5.4",
"doctrine/orm": "^2.5.4",
"phpunit/phpunit": "^7.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "For using MongoDB ODM with PHP 7",
"doctrine/mongodb-odm": "For loading MongoDB ODM fixtures",
"doctrine/orm": "For loading ORM fixtures",
"doctrine/phpcr-odm": "For loading PHPCR ODM fixtures"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Data Fixtures for all Doctrine Object Managers",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"database"
],
"time": "2018-03-20T09:06:36+00:00"
},
{
"name": "doctrine/dbal",
"version": "dev-master",
@ -5597,6 +5657,8 @@
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": [],
"platform": {
"php": ">=7.2"
},
"platform-dev": []
}

View File

@ -32,8 +32,8 @@ $cli->setHelperSet($helperSet);
// Migrations commands
$migrate_config = new \Doctrine\DBAL\Migrations\Configuration\Configuration($db);
$migrate_config->setMigrationsTableName('app_migrations');
$migrate_config->setMigrationsDirectory(__DIR__.'/../app/src/Migration');
$migrate_config->setMigrationsNamespace('Migration');
$migrate_config->setMigrationsDirectory(__DIR__.'/../app/src/Entity/Migration');
$migrate_config->setMigrationsNamespace('Entity\Migration');
$output = new \Symfony\Component\Console\Output\ConsoleOutput;
$migrate_config->setOutputWriter(new \Doctrine\DBAL\Migrations\OutputWriter(function($message) use ($output) {
@ -71,6 +71,7 @@ $cli->addCommands([
// Setup
new \AzuraCast\Console\Command\MigrateConfig($di),
new \AzuraCast\Console\Command\SetupInflux($di),
new \AzuraCast\Console\Command\SetupFixtures($di),
// Maintenance
new \AzuraCast\Console\Command\ClearCache($di),

View File

@ -1,18 +0,0 @@
#!/usr/bin/env bash
read -p "This operation is destructive and will wipe your existing Docker containers. Continue? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker-compose down -v
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker volume prune -f
docker-compose build
docker-compose run --rm cli azuracast_install --dev
docker-compose up -d
docker-compose rm -f
fi

File diff suppressed because it is too large Load Diff