Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old entities, fixtures and tables after migration #77

Open
wants to merge 324 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
324 commits
Select commit Hold shift + click to select a range
4c164af
Merge branch 'v2-api-development' of https://github.com/nus-fboa2016-…
Gisonrg Feb 24, 2016
382a325
consider if a library is disabled when checking external library
Gisonrg Feb 24, 2016
3b61533
show files for all versions if no version given for fetch command
Gisonrg Feb 24, 2016
fa0b9bb
Implement new view template for viewing libraries. Add v2 view templa…
Gisonrg Feb 24, 2016
2fec3c6
Version added on the form
bsmmoon Feb 25, 2016
b92078d
Changing namings
bsmmoon Feb 25, 2016
558c4a4
More renaming
bsmmoon Feb 25, 2016
bf74755
Changing saveNewLibrary
bsmmoon Feb 25, 2016
418e695
Refactoring
bsmmoon Feb 25, 2016
4499bfe
Fix typo in method name
thngkaiyuan Feb 26, 2016
6366ee8
Remove magic branch
thngkaiyuan Feb 26, 2016
819b0d4
Correct another typo of getLiraryMeta
thngkaiyuan Feb 26, 2016
d6c10c6
Implement isLibraryInSyncWithGit method and refactor code
thngkaiyuan Feb 26, 2016
657653d
Added NewLibraryCommand
bsmmoon Feb 26, 2016
0803170
Version setters placed
bsmmoon Feb 26, 2016
7fea9ec
Added ToDo
bsmmoon Feb 26, 2016
9cafa6a
Update search action for v2 API
thngkaiyuan Feb 26, 2016
f593930
Naming conflict resolution. Refactoring.
bsmmoon Feb 26, 2016
3f97f93
Refactoring. Renaming.
bsmmoon Feb 26, 2016
81cdca9
Turn fetchLibraryFiles and fetchLibraryExamples public
thngkaiyuan Feb 26, 2016
558170a
Implement v2 of downloadAction
thngkaiyuan Feb 26, 2016
d7b6376
Refactor common methods into API handler
thngkaiyuan Feb 26, 2016
2f8dc5d
Fix the broken search UI
Gisonrg Feb 26, 2016
e0172ab
Add more test cases to strengthen test coverage
Gisonrg Feb 26, 2016
5c85eca
Fixing api list. Needs clarification on LibraryExample entity.
bsmmoon Feb 26, 2016
6a45e68
Passed the test
bsmmoon Feb 26, 2016
b58653a
Putting the structure. Needs to clarify schema design.
bsmmoon Feb 26, 2016
62dbe7a
Error is gone. Needs to refine the output and make test.
bsmmoon Feb 27, 2016
2f53ab1
Finalized. Test added.
bsmmoon Feb 27, 2016
6968641
Fix the UI for add new library. Create a new handler for adding new l…
Gisonrg Feb 27, 2016
14992ef
Fix NewLibraryHandler's injection issue
Gisonrg Feb 27, 2016
06491b9
Fix createLibraryDirectory
bsmmoon Feb 27, 2016
d1ca7db
Fix saveEntities
bsmmoon Feb 27, 2016
f7d322d
Fix the bug that defaultHeader is empty
Gisonrg Feb 27, 2016
156bbb8
Merge branch 'api-new-library' of https://github.com/nus-fboa2016-CB/…
Gisonrg Feb 27, 2016
18daa24
Merge remote-tracking branch 'origin/api-new-library' into api-new-li…
bsmmoon Feb 27, 2016
006b7bf
Logic improved for default header and folder name conflict
bsmmoon Feb 27, 2016
eb5a538
Needs to fix flush from saveNewVersionAndExamples
bsmmoon Feb 27, 2016
eb6d811
Fixed wrong array keys
bsmmoon Feb 27, 2016
c12a8fa
Fix the bug in adding brand new library
bsmmoon Feb 28, 2016
c3d9b09
Change the logic of setting folder name.
Gisonrg Feb 28, 2016
001d342
fix bugs when adding new examples, update the UI for adding version d…
Gisonrg Feb 28, 2016
66ff2e5
Library version duplicate check added
bsmmoon Feb 28, 2016
530482a
allow a repo with empty description in javascript
Gisonrg Feb 28, 2016
7b4557e
Merge branch 'api-new-library' of https://github.com/nus-fboa2016-CB/…
Gisonrg Feb 28, 2016
ad5fe55
Conflict resolution for version
bsmmoon Feb 28, 2016
bbd6aa9
Fixed bug in name conflict resolution. Conflict resolution added to l…
bsmmoon Feb 28, 2016
6270ffe
Merge remote-tracking branch 'origin/api-new-library' into api-new-li…
bsmmoon Feb 28, 2016
3133db7
Implement download button for different version
Gisonrg Feb 28, 2016
0d0af70
Add a functional test for view library files
Gisonrg Feb 28, 2016
e03e55e
add test for search library view and download library
Gisonrg Feb 28, 2016
98a6ae1
Fix two bugs when adding new library
Gisonrg Feb 28, 2016
d52488a
Merge branch 'v2-api-development' into api-new-library
Gisonrg Feb 28, 2016
6dfa4f8
Merge branch 'api-new-library' into v2-api-development
Gisonrg Feb 28, 2016
012a9e7
Refactor and fix style to follow PSR-2
Gisonrg Feb 28, 2016
1f49ee2
Merge pull request #6 from nus-fboa2016-CB/fix/api-list
Gisonrg Feb 28, 2016
4ebbb67
Fix miscellaneous bugs in NewLibraryHandler
thngkaiyuan Mar 1, 2016
c79e73d
Add AddGitLibrary test
thngkaiyuan Mar 1, 2016
78cc3ec
Add handling for version notes
thngkaiyuan Mar 1, 2016
518a39f
Add test for version notes
thngkaiyuan Mar 1, 2016
24f5047
Add AddZipLibrary test
thngkaiyuan Mar 1, 2016
9dd3fd9
Add AddGitLibraryFromSubfolder test
thngkaiyuan Mar 1, 2016
c6a372e
Add test for adding library larger than 1MB
thngkaiyuan Mar 1, 2016
17e778d
Fixed api list to use the new database design
bsmmoon Mar 1, 2016
70b3453
Test amended for change
bsmmoon Mar 1, 2016
27a610a
Remove redundant else clause
thngkaiyuan Mar 2, 2016
de9a9fe
Remove variables
thngkaiyuan Mar 2, 2016
01c351e
Remove redundant elseifs
thngkaiyuan Mar 2, 2016
4aa0ded
Fix comment typo
thngkaiyuan Mar 2, 2016
77f8258
Add methods to get and compare commit timestamps
thngkaiyuan Mar 1, 2016
14d2642
Update library lastCommit if newer version is added
thngkaiyuan Mar 1, 2016
c6dd233
Refactor code to follow PSR-2 standard
Gisonrg Mar 1, 2016
6d6c2df
Refactor the function parameter name to be more generic
Gisonrg Mar 1, 2016
d2adcfe
Implement adding library version from git releases
Gisonrg Mar 1, 2016
de1635a
Fix bug in NewLibraryHandler
thngkaiyuan Mar 1, 2016
3bad16b
Add test for adding of release and updating of lastCommit
thngkaiyuan Mar 1, 2016
119886c
testViewBuiltinExample added
bsmmoon Mar 1, 2016
36b25f0
testViewExternalZipLibrary added
bsmmoon Mar 1, 2016
23e5afd
testViewExternalGitLibrary added
bsmmoon Mar 1, 2016
070f739
Fix a bug in condition
Gisonrg Mar 5, 2016
76acf5c
Removed duplicate test case
bsmmoon Mar 5, 2016
71a1455
Add a new API for getting library meta
Gisonrg Mar 5, 2016
b5e67b5
Implement page logic to check for header file name when adding new li…
Gisonrg Mar 5, 2016
97240a3
Show version notes in to the view-library view
Gisonrg Mar 6, 2016
cb38b22
Add multiple partner authentication
thngkaiyuan Mar 8, 2016
8269868
Add authentication tests
thngkaiyuan Mar 8, 2016
a53792f
Implement the view for select architectures when adding new library
Gisonrg Mar 9, 2016
94a49e1
Save architectures for the newly created version
Gisonrg Mar 9, 2016
0c75bc0
Show supported architectures in view-library view
Gisonrg Mar 9, 2016
b2c456a
Update controller test to check for architectures
Gisonrg Mar 9, 2016
89092aa
Style fix for new library form
Gisonrg Mar 9, 2016
d37b80a
Fix issues from code review
Gisonrg Mar 10, 2016
7e42b20
Improve code for areSimilarArrays method
thngkaiyuan Mar 12, 2016
da98a2d
Latest Version can be added
bsmmoon Mar 12, 2016
92a2446
FetchLatestApiCommand routing
bsmmoon Mar 13, 2016
c17b307
Add a model window to alert user for header file name collision
Gisonrg Mar 13, 2016
c098509
Fetch latest added.
bsmmoon Mar 13, 2016
c88349f
No library parameter corner case
bsmmoon Mar 13, 2016
540c39e
Tests added for fetchLatest. One more test for fetch. Fixture changed…
bsmmoon Mar 13, 2016
c7d2dd3
Instead of latestVersionId use latestVersion foreign key
bsmmoon Mar 14, 2016
dbc4529
Slight test enhancement
bsmmoon Mar 14, 2016
ad964ac
Copied built in libraries into the external library new directory
bsmmoon Mar 14, 2016
b347280
Added is_built_in column to the Library entity. Fixtures added.
bsmmoon Mar 14, 2016
2140b87
built-in and external are fetched in the same manner
bsmmoon Mar 14, 2016
8c8ac09
Added fixtures for examples.
bsmmoon Mar 14, 2016
bd6a08d
List api changed for the new structure. Tests updated.
bsmmoon Mar 14, 2016
c5e0af6
Fixed some broken APIs
bsmmoon Mar 14, 2016
82adfdd
List Api includes Examples again.
bsmmoon Mar 14, 2016
f577b65
Regression found in API tests related to obsolete builtin-libraries a…
bsmmoon Mar 14, 2016
04cd07a
Builtin library view test fixed
bsmmoon Mar 14, 2016
6503ddf
Added TODOs for potential renaming of misleading function names
bsmmoon Mar 14, 2016
276be7e
Fixed wrong doc on Library entity.
bsmmoon Mar 15, 2016
f3f029f
Add migration for adding latest_version_id column
thngkaiyuan Mar 15, 2016
b6c82a3
Made Library latest_version non-nullable. Fixtures changed accordingly.
bsmmoon Mar 15, 2016
19fb0d9
Fixing add new library
bsmmoon Mar 15, 2016
2811da9
NewLibrary will work under the latest_version constraint. Refactoring.
bsmmoon Mar 15, 2016
3fc2202
Merge remote-tracking branch 'origin/implement-fetchLatest-api' into …
bsmmoon Mar 15, 2016
7477298
Merge branch 'combine-builtin-with-external' into merge-fetchLatest-a…
bsmmoon Mar 15, 2016
0b3c388
Use string interpolation for error message
thngkaiyuan Mar 15, 2016
42d9a06
Use literal quotes for string that doesn't include variables
thngkaiyuan Mar 15, 2016
98cf8a9
Use stricter regex pattern for keywords finder
thngkaiyuan Mar 15, 2016
b928637
Change method not null comparison to operator comparison
thngkaiyuan Mar 15, 2016
704f3e4
Fix code style
Gisonrg Mar 15, 2016
c6ca928
Fix code style for review
Gisonrg Mar 15, 2016
06170b1
Refactoring
bsmmoon Mar 15, 2016
306ab97
Remove debugging code
thngkaiyuan Mar 16, 2016
6934618
Replace long method with string casting
thngkaiyuan Mar 16, 2016
13bcbd7
Refactoring
bsmmoon Mar 16, 2016
2aa3a57
Refactor for code review
Gisonrg Mar 16, 2016
32d55cc
Refactor for code review
Gisonrg Mar 16, 2016
46048ef
Merge branch 'milestone2-base' into milestone2-api-getExamples
Gisonrg Mar 16, 2016
e3b7e6f
Change the alert text displayed in modal window
Gisonrg Mar 16, 2016
d96ef47
Fix Javascript code style
Gisonrg Mar 16, 2016
98fa0d5
Merge pull request #46 from codebendercc/milestone2-api-getExamples
thngkaiyuan Mar 17, 2016
a053391
Merge branch 'milestone2-api-getversions' into milestone2-base
thngkaiyuan Mar 17, 2016
0ed0648
Merge branch 'milestone2-api-getkeywords' into milestone2-base
thngkaiyuan Mar 17, 2016
797ed4d
Merge branch 'milestone2-api-checkgithubupdates' into milestone2-base
thngkaiyuan Mar 17, 2016
61a210b
Merge branch 'milestone2-api-list' into milestone2-base
thngkaiyuan Mar 17, 2016
f819d52
Remove .idea file
thngkaiyuan Mar 17, 2016
e2867fb
Merge branch 'milestone2-base' into milestone2-api-getExampleCode
Gisonrg Mar 17, 2016
f57cfdf
Merge branch 'milestone2-api-getExampleCode' into milestone2-base
Gisonrg Mar 17, 2016
86203d7
Merge remote-tracking branch 'origin/milestone2-base' into milestone2…
bsmmoon Mar 18, 2016
1164aef
Merge pull request #44 from codebendercc/milestone2-api-fetch2
bsmmoon Mar 18, 2016
5c5d644
Merge pull request #39 from codebendercc/milestone2-base
thngkaiyuan Mar 18, 2016
810377b
Merge pull request #48 from codebendercc/create-new-entities
thngkaiyuan Mar 18, 2016
bb7bf71
Merge remote-tracking branch 'origin/v2-api-development' into PR53-co…
bsmmoon Mar 18, 2016
67e274c
Resolve merge conflicts
bsmmoon Mar 18, 2016
6c28e60
Fix expected strings for getKeywords test cases
thngkaiyuan Mar 19, 2016
9f5ffa1
Create handler functions for create/update/retrieve partner's preferr…
Gisonrg Mar 15, 2016
be63c61
Create a new API to get default version of a library for a partner
Gisonrg Mar 15, 2016
4e81057
Fix the parameter checking bug
Gisonrg Mar 15, 2016
b24bce7
Add test case for getDefaultCommand
Gisonrg Mar 15, 2016
57e50dd
Refactor getDefaultVersion command
Gisonrg Mar 19, 2016
28a3dc3
Fetch Api considers default version.
bsmmoon Mar 19, 2016
e264d17
RenderView returns version if asked for specific version
bsmmoon Mar 19, 2016
4016015
Configure default version for Api commands
Gisonrg Mar 19, 2016
88547a8
Add test cases for default version for Api commands
Gisonrg Mar 19, 2016
8e325e5
Merge branch 'implement-partner-default-version' of https://github.co…
Gisonrg Mar 19, 2016
1d7c638
Refactor code style
Gisonrg Mar 21, 2016
13f4b80
Merge branch 'implement-partner-default-version' into move-builtin-lib
bsmmoon Mar 21, 2016
d6cce6e
Merge branch 'implement-partner-default-version' into combine-builtin…
bsmmoon Mar 21, 2016
34a86e1
Fixed fetch API to consider default version. Changed fixture and test…
bsmmoon Mar 23, 2016
a2ba44a
DefaultHandler pruned. v1 will use v2 commands as well
bsmmoon Mar 23, 2016
01f121b
Inserted guard clause to avoid null exception
bsmmoon Mar 24, 2016
4f645ae
Removed usage of DefaultHandler from NewLibraryHandler
bsmmoon Mar 24, 2016
5f9e25b
Removed usage of DefaultHandler from ApiViewsController
bsmmoon Mar 24, 2016
9e8205c
Removed usage of DefaultHandler from ViewsController. DefaultHandler …
bsmmoon Mar 24, 2016
701aa61
Remove old external library files
Gisonrg Mar 25, 2016
2efe360
Remove legacy v1 view controller and view controller test
Gisonrg Mar 25, 2016
95d50c0
Modify the load command to load only v2 external files
Gisonrg Mar 25, 2016
5e7b6ef
Fix a missing path in DefaultControllerTest
Gisonrg Mar 25, 2016
4648209
Remove unused code in the ApiHandler
Gisonrg Mar 25, 2016
b271121
Remove v1's view template and rename v2's view template folder
Gisonrg Mar 25, 2016
885cad1
Remove v1's view from router config file.
Gisonrg Mar 25, 2016
69c6f5d
Removed v1's new library form
Gisonrg Mar 25, 2016
5ba1f87
Correct a path issue in the test case
Gisonrg Mar 25, 2016
ebffc91
Display the collision file name in the modal window
Gisonrg Mar 25, 2016
2445634
Make the same fix as fpapadopou for v2
thngkaiyuan Mar 26, 2016
19a3a4d
Remove unused code in handlers
Gisonrg Mar 26, 2016
d0818d7
Add migration script
thngkaiyuan Mar 15, 2016
72dc654
Fix minor error in ORM annotation
thngkaiyuan Mar 15, 2016
0354779
Set version of external libraries to be CB-1
thngkaiyuan Mar 17, 2016
e82b3ef
Do not remove old files upon migration
thngkaiyuan Mar 17, 2016
904870a
Change migration script to use new ApiHandler
thngkaiyuan Mar 26, 2016
70ad351
Merge branch 'implement-v2-views-and-tests' into add-version-notes-to…
Gisonrg Mar 26, 2016
71cc062
Merge branch 'implement-v2-views-and-tests' into implement-support-ar…
Gisonrg Mar 26, 2016
c15e94d
Merge remote-tracking branch 'origin/implement-v2-views-and-tests' in…
bsmmoon Mar 26, 2016
1050382
Merge branch 'implement-fetchLatest-api' into implement-partner-defau…
Gisonrg Mar 27, 2016
4ed0b46
Enhance the test coverage for fetch command
Gisonrg Mar 27, 2016
f81f7f0
Add tests for getGitInformation and changeLibraryStatus
Gisonrg Mar 27, 2016
10b32f0
Hide toggle status button when view built-in libraries
Gisonrg Mar 27, 2016
93c62bd
Merge branch 'zip-upload-utf8-fix-v2' into remove-v1-legacy-files
Gisonrg Mar 28, 2016
4a5a210
Merge remote-tracking branch 'origin/hide-toggle-button-for-builtin' …
Gisonrg Mar 28, 2016
9eec2e0
Merge branch 'combine-builtin-with-external' into move-builtin-lib
Gisonrg Mar 28, 2016
c68e7c4
Merge branch 'move-builtin-lib' into implement-partner-default-versio…
Gisonrg Mar 28, 2016
7d8082b
Merge remote-tracking branch 'origin/implement-partner-authentication…
Gisonrg Mar 28, 2016
41048b4
Merge branch 'implement-partner-default-version-fix' into implement-v…
Gisonrg Mar 28, 2016
bd1178c
Merge remote-tracking branch 'origin/add-version-notes-to-view' into …
Gisonrg Mar 28, 2016
db3d052
Merge remote-tracking branch 'origin/check-header-when-adding-libs' i…
Gisonrg Mar 28, 2016
19867fb
Merge remote-tracking branch 'origin/add-more-tests' into implement-v…
Gisonrg Mar 28, 2016
71ed71e
Fix the library saving issue
Gisonrg Mar 28, 2016
bd15272
Add missing filename variable
Gisonrg Mar 28, 2016
c55e26c
Fix the missing key in the test case
Gisonrg Mar 28, 2016
c03c345
Add a few more architectures
thngkaiyuan Mar 30, 2016
94ebf54
Merge branch 'migrate-v1-database-and-files-to-v2-proper' into v2-mer…
thngkaiyuan Mar 30, 2016
f46d987
Fixed comment grammar
bsmmoon Mar 31, 2016
6d2086f
Merge branch 'implement-fetchLatest-api' into v2-merged-2
bsmmoon Mar 31, 2016
49ecf38
findBaseDir refactored
bsmmoon Mar 31, 2016
324aea8
removed else
bsmmoon Mar 31, 2016
4a21db9
Merge branch 'remove-duplicate-codes' into v2-merged-2
bsmmoon Mar 31, 2016
c389c3b
Rename external_libraries_new to external_libraries_v2
thngkaiyuan Mar 31, 2016
021b999
Merge branch 'rename-external-libraries-parameter' into v2-merged-2
thngkaiyuan Mar 31, 2016
bc377f7
json encode removed
bsmmoon Mar 31, 2016
01e8bc4
Merge remote-tracking branch 'origin/v2-merged-2' into v2-merged-2
bsmmoon Mar 31, 2016
9b8f832
removed else from isExternalLibrary
bsmmoon Mar 31, 2016
7d54d7e
Merge branch 'combine-builtin-with-external' into v2-merged-2
bsmmoon Mar 31, 2016
79b96c7
Fix the list command format for v1 api
Gisonrg Apr 5, 2016
3661818
Fix getExampleCode command for handling built-in libraries
Gisonrg Apr 6, 2016
e3c8a7b
Fix getExamples command for handling built-in libraries
Gisonrg Apr 6, 2016
8542d52
Fix a bug that causing failure in default controller test
Gisonrg Apr 6, 2016
8474a3f
Fix the list command format for v1 api
Gisonrg Apr 5, 2016
d25927a
Fix a bug that causing failure in default controller test
Gisonrg Apr 6, 2016
6a17e64
Fix List format issue
bsmmoon Apr 6, 2016
3839dd4
Merge branch 'remove-duplicate-codes' into v2-merged-2
bsmmoon Apr 6, 2016
725844f
Merge remote-tracking branch 'origin/v2-merged-2' into v2-merged-2
bsmmoon Apr 6, 2016
8bfbc03
List to handle the current directory dot
bsmmoon Apr 6, 2016
56839d9
Merge branch 'remove-duplicate-codes' into v2-merged-2
bsmmoon Apr 6, 2016
97cef16
Changed name to follow the naming convention
bsmmoon Apr 7, 2016
fb277de
Change getExample API error messages
thngkaiyuan Apr 7, 2016
2cf29fd
Change error message for getKeywords API
thngkaiyuan Apr 7, 2016
d196080
Change getExample API error messages again
thngkaiyuan Apr 7, 2016
b881aaf
Delete Command implemented. Handling of new latestVersion missing.
bsmmoon Apr 8, 2016
247dee4
Fixtures added for testing. Tests added. Needs permission fix.
bsmmoon Apr 8, 2016
916daee
Better modularization.
bsmmoon Apr 9, 2016
5baefac
More testing cases
bsmmoon Apr 9, 2016
4355d8c
Added message on successful delete.
bsmmoon Apr 9, 2016
e1902d0
Add deletion button in the viewLibrary page
Gisonrg Apr 9, 2016
eb51959
Fix bug in deleteLibrary API
thngkaiyuan Apr 9, 2016
d1d79a1
Rename delete to deleteLibrary for clarity
thngkaiyuan Apr 9, 2016
775ba95
Latest version handling added.
bsmmoon Apr 9, 2016
180b7b8
Separated database handling from other logic for safety. Can fail mor…
bsmmoon Apr 9, 2016
c6c98b7
Added new tests for deleting a latest version. New fixtures added for…
bsmmoon Apr 9, 2016
63cfe4e
Implement alternative way of changing latest version in delete api
thngkaiyuan Apr 9, 2016
11e486b
Fix a bug and set the last commit of the library after changing the l…
thngkaiyuan Apr 9, 2016
84b0f29
Add some test documentation
thngkaiyuan Apr 9, 2016
02a47b3
Merge branch 'master' into v2-merged-2
thngkaiyuan Apr 9, 2016
5d8794e
Code style fix
Gisonrg Apr 10, 2016
46e5dce
Add a latest version name field in library meta
Gisonrg Apr 10, 2016
27e442f
Implement front-end for deleting a library
Gisonrg Apr 10, 2016
d2f3cb9
Remove old entities, fixtures and tables
thngkaiyuan Mar 31, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion Symfony/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public function registerBundles()
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Codebender\LibraryBundle\CodebenderLibraryBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle()
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle()
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
Expand Down
55 changes: 55 additions & 0 deletions Symfony/app/DoctrineMigrations/Version20160203104457.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

class Version20160203104457 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE TABLE Architecture (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX name_idx (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE Library (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, default_header VARCHAR(255) NOT NULL, folder_name VARCHAR(255) NOT NULL, description VARCHAR(2048) NOT NULL, owner VARCHAR(255) DEFAULT NULL, repo VARCHAR(255) DEFAULT NULL, branch VARCHAR(255) DEFAULT NULL, in_repo_path VARCHAR(255) DEFAULT NULL, notes LONGTEXT DEFAULT NULL, verified TINYINT(1) NOT NULL, active TINYINT(1) NOT NULL, last_commit VARCHAR(255) DEFAULT NULL, url VARCHAR(512) DEFAULT NULL, UNIQUE INDEX header_idx (default_header, folder_name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE LibraryExample (id INT AUTO_INCREMENT NOT NULL, version_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, path VARCHAR(255) NOT NULL, boards VARCHAR(2048) DEFAULT NULL, INDEX IDX_3EE4A5D34BBC2705 (version_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE Partner (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, auth_key VARCHAR(255) NOT NULL, UNIQUE INDEX auth_key_idx (auth_key), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE Preference (id INT AUTO_INCREMENT NOT NULL, library_id INT DEFAULT NULL, partner_id INT DEFAULT NULL, version_id INT DEFAULT NULL, INDEX IDX_1234B383FE2541D7 (library_id), INDEX IDX_1234B3839393F8FE (partner_id), INDEX IDX_1234B3834BBC2705 (version_id), UNIQUE INDEX search_idx (library_id, partner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE Version (id INT AUTO_INCREMENT NOT NULL, library_id INT DEFAULT NULL, version VARCHAR(255) NOT NULL, description VARCHAR(2048) DEFAULT NULL, notes LONGTEXT DEFAULT NULL, source_url VARCHAR(512) DEFAULT NULL, release_commit VARCHAR(255) DEFAULT NULL, folder_name VARCHAR(255) NOT NULL, INDEX IDX_70A1EA5FFE2541D7 (library_id), UNIQUE INDEX folders_idx (library_id, folder_name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE ArchitectureVersion (version_id INT NOT NULL, architecture_id INT NOT NULL, INDEX IDX_98E4E2F14BBC2705 (version_id), INDEX IDX_98E4E2F173F96878 (architecture_id), PRIMARY KEY(version_id, architecture_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE LibraryExample ADD CONSTRAINT FK_3EE4A5D34BBC2705 FOREIGN KEY (version_id) REFERENCES Version (id)');
$this->addSql('ALTER TABLE Preference ADD CONSTRAINT FK_1234B383FE2541D7 FOREIGN KEY (library_id) REFERENCES Library (id)');
$this->addSql('ALTER TABLE Preference ADD CONSTRAINT FK_1234B3839393F8FE FOREIGN KEY (partner_id) REFERENCES Partner (id)');
$this->addSql('ALTER TABLE Preference ADD CONSTRAINT FK_1234B3834BBC2705 FOREIGN KEY (version_id) REFERENCES Version (id)');
$this->addSql('ALTER TABLE Version ADD CONSTRAINT FK_70A1EA5FFE2541D7 FOREIGN KEY (library_id) REFERENCES Library (id)');
$this->addSql('ALTER TABLE ArchitectureVersion ADD CONSTRAINT FK_98E4E2F14BBC2705 FOREIGN KEY (version_id) REFERENCES Version (id)');
$this->addSql('ALTER TABLE ArchitectureVersion ADD CONSTRAINT FK_98E4E2F173F96878 FOREIGN KEY (architecture_id) REFERENCES Architecture (id)');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE ArchitectureVersion DROP FOREIGN KEY FK_98E4E2F173F96878');
$this->addSql('ALTER TABLE Preference DROP FOREIGN KEY FK_1234B383FE2541D7');
$this->addSql('ALTER TABLE Version DROP FOREIGN KEY FK_70A1EA5FFE2541D7');
$this->addSql('ALTER TABLE Preference DROP FOREIGN KEY FK_1234B3839393F8FE');
$this->addSql('ALTER TABLE LibraryExample DROP FOREIGN KEY FK_3EE4A5D34BBC2705');
$this->addSql('ALTER TABLE Preference DROP FOREIGN KEY FK_1234B3834BBC2705');
$this->addSql('ALTER TABLE ArchitectureVersion DROP FOREIGN KEY FK_98E4E2F14BBC2705');
$this->addSql('DROP TABLE Architecture');
$this->addSql('DROP TABLE Library');
$this->addSql('DROP TABLE LibraryExample');
$this->addSql('DROP TABLE Partner');
$this->addSql('DROP TABLE Preference');
$this->addSql('DROP TABLE Version');
$this->addSql('DROP TABLE ArchitectureVersion');
}
}
38 changes: 38 additions & 0 deletions Symfony/app/DoctrineMigrations/Version20160315080428.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160315080428 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE Library ADD latest_version_id INT');
$this->addSql('ALTER TABLE Library ADD CONSTRAINT FK_6E3DA1205F67402F FOREIGN KEY (latest_version_id) REFERENCES Version (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6E3DA1205F67402F ON Library (latest_version_id)');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE Library DROP FOREIGN KEY FK_6E3DA1205F67402F');
$this->addSql('DROP INDEX UNIQ_6E3DA1205F67402F ON Library');
$this->addSql('ALTER TABLE Library DROP latest_version_id');
}
}
270 changes: 270 additions & 0 deletions Symfony/app/DoctrineMigrations/Version20160315081844.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
<?php

namespace Application\Migrations;

use Codebender\LibraryBundle\Entity\Architecture;
use Codebender\LibraryBundle\Entity\Example;
use Codebender\LibraryBundle\Entity\ExternalLibrary;
use Codebender\LibraryBundle\Entity\Library;
use Codebender\LibraryBundle\Entity\LibraryExample;
use Codebender\LibraryBundle\Entity\Partner;
use Codebender\LibraryBundle\Entity\Preference;
use Codebender\LibraryBundle\Entity\Version;
use Codebender\LibraryBundle\Handler\ApiHandler;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Finder\Finder;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160315081844 extends AbstractMigration implements ContainerAwareInterface
{
private $container;

public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}

/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE Library ADD is_built_in TINYINT(1) NOT NULL');
}

public function postUp(Schema $schema)
{
/* @var EntityManager $entityManager */
$entityManager = $this->container->get('doctrine.orm.entity_manager');

/*
* 1. Create the various Arduino architectures
*/
$avrArchitecture = new Architecture();
$avrArchitecture->setName('AVR');

$esp8266Architecture = new Architecture();
$esp8266Architecture->setName('ESP8266');

$edisonArchitecture = new Architecture();
$edisonArchitecture->setName('Intel Edison');

$teensyArchitecture = new Architecture();
$teensyArchitecture->setName('Teensy');

$architectures = [$avrArchitecture, $esp8266Architecture, $edisonArchitecture, $teensyArchitecture];
foreach ($architectures as $architecture) {
$entityManager->persist($architecture);
}
$entityManager->flush();

/*
* 2. Migrate existing external libraries and add AVR architecture to them
*/
$externalLibraries = $entityManager->getRepository('CodebenderLibraryBundle:ExternalLibrary')
->findAll();
$externalLibraryVersion = 'CB-1';
/* @var ExternalLibrary $externalLibrary */
foreach ($externalLibraries as $externalLibrary) {
$defaultHeader = $externalLibrary->getMachineName();
print("Migrating external lib: $defaultHeader\n");

// Do not migrate the SD external library
if ($defaultHeader === 'SD') continue;

/*
* Migrate all the existing attributes
*/
$library = new Library();
$library->setName($externalLibrary->getHumanName());
$library->setDefaultHeader($externalLibrary->getMachineName());
$library->setFolderName($externalLibrary->getMachineName());
$library->setDescription($externalLibrary->getDescription());
$library->setOwner($externalLibrary->getOwner());
$library->setRepo($externalLibrary->getRepo());
$library->setBranch($externalLibrary->getBranch());
$library->setInRepoPath($externalLibrary->getInRepoPath());
$library->setNotes($externalLibrary->getNotes());
$library->setVerified($externalLibrary->getVerified());
$library->setActive($externalLibrary->getActive());
$library->setLastCommit($externalLibrary->getLastCommit());
$library->setUrl($externalLibrary->getUrl());
$library->setIsBuiltIn(False);

$version = new Version();
$version->setLibrary($library);
$version->setVersion($externalLibraryVersion);
$version->setDescription($externalLibrary->getDescription());
$version->setNotes($externalLibrary->getNotes());
$version->setSourceUrl($externalLibrary->getSourceUrl());
$version->setFolderName($externalLibraryVersion);
$version->addArchitecture($avrArchitecture);

$examples = $entityManager->getRepository('CodebenderLibraryBundle:Example')
->findBy(['library' => $externalLibrary]);
/* @var Example $example */
foreach ($examples as $example) {
$position = strpos($example->getPath(), '/');
$newExamplePath = substr($example->getPath(), $position + 1);

$libraryExample = new LibraryExample();
$libraryExample->setName($example->getName());
$libraryExample->setVersion($version);
$libraryExample->setBoards($example->getBoards());
$libraryExample->setPath($newExamplePath);

$entityManager->persist($libraryExample);
}

$library->addVersion($version);
$library->setLatestVersion($version);

/*
* Persist and move library files
*/
$entityManager->persist($library);
$entityManager->persist($version);
$this->moveExternalLibraryFiles($defaultHeader, $externalLibraryVersion);
}
$entityManager->flush();

/*
* 3. Migrate existing built-in libraries as external libraries and add AVR architecture to them
*/
$builtInVersion = '1.0.5';
$builtInLibrariesPath = $this->container->getParameter('builtin_libraries') . '/libraries';
$finder = new Finder();
$finder->depth(0);
/* @var SplFileInfo $builtInLibrary */
foreach ($finder->in($builtInLibrariesPath) as $builtInLibrary) {
/*
* Migrate any existing attributes
*/
$defaultHeader = $builtInLibrary->getFilename();
print("Migrating built-in lib: $defaultHeader\n");

$library = new Library();
$library->setName($defaultHeader);
$library->setDefaultHeader($defaultHeader);
$library->setFolderName($defaultHeader);
$library->setDescription($defaultHeader . ' v' . $builtInVersion);
$library->setVerified(True);
$library->setActive(True);
$library->setIsBuiltIn(True);

$version = new Version();
$version->setLibrary($library);
$version->setVersion($builtInVersion);
$version->setFolderName($builtInVersion);
$version->addArchitecture($avrArchitecture);

/* @var ApiHandler $handler */
$handler = $this->container->get('codebender_library.apiHandler');
$examples = $handler->fetchLibraryExamples(new Finder(), $builtInLibrary->getPathname());
foreach ($examples as $example) {
$libraryExample = new LibraryExample();
$libraryExample->setVersion($version);
$libraryExample->setName(pathinfo($example['filename'])['filename']);
$libraryExample->setPath($example['filename']);
$libraryExample->setBoards(null);

$entityManager->persist($libraryExample);
}

$library->addVersion($version);
$library->setLatestVersion($version);

/*
* Persist and move library files
*/
$entityManager->persist($library);
$entityManager->persist($version);
$this->moveBuiltInLibraryFiles($builtInLibrary, $builtInVersion);
}
$entityManager->flush();

/*
* 4. Migrate existing authorization key
*/
$authorizationKey = $this->container->getParameter('authorizationKey');
$codebender = new Partner();
$codebender->setName('Codebender');
$codebender->setAuthKey($authorizationKey);
$entityManager->persist($codebender);
$entityManager->flush();

/*
* 5. Set all existing versions as the preferred version for Codebender
*/
$libraries = $entityManager->getRepository('CodebenderLibraryBundle:Library')->findAll();
/* @var Library $library */
foreach ($libraries as $library) {
$preference = new Preference();
$preference->setLibrary($library);
$preference->setVersion($library->getLatestVersion());
$codebender->addPreference($preference);

$entityManager->persist($preference);
$entityManager->persist($codebender);
}
$entityManager->flush();
}

/**
* This method moves an existing built-in library folder from the given sourceFolder to its
* new location. The old directory is removed after this operation.
*
* @param SplFileInfo $sourceFolder
* @param $version
*/
private function moveBuiltInLibraryFiles(SplFileInfo $sourceFolder, $version)
{
$defaultHeader = $sourceFolder->getFilename();

/* @var Filesystem $filesystem */
$filesystem = new Filesystem();
$sourcePath = $sourceFolder->getPathname();
$destinationRootDirectory = $this->container->getParameter('external_libraries_v2');
$destinationPath = $destinationRootDirectory . '/' . $defaultHeader . '/' . $version;
$filesystem->mirror($sourcePath, $destinationPath);
}

/**
* This method moves an existing external library folder from the existing location to its
* new location. The old directory is removed after this operation.
*
* @param $defaultHeader
* @param $version
*/
private function moveExternalLibraryFiles($defaultHeader, $version)
{
/* @var Filesystem $filesystem */
$filesystem = new Filesystem();
$sourceRootDirectory = $this->container->getParameter('external_libraries');
$destinationRootDirectory = $this->container->getParameter('external_libraries_v2');
$sourcePath = $sourceRootDirectory . '/' . $defaultHeader;
$destinationPath = $destinationRootDirectory . '/' . $defaultHeader . '/' . $version;
$filesystem->mirror($sourcePath, $destinationPath);
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE Library DROP is_built_in');
}
}
Loading