Skip to content

Commit

Permalink
Merge pull request #5 from utopia-dart/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
lohanidamodar authored Mar 14, 2024
2 parents 377c053 + 83141ff commit 7aa7a8b
Show file tree
Hide file tree
Showing 38 changed files with 125 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: MariaDB tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -14,7 +14,7 @@ on:

defaults:
run:
working-directory: utopia_database/
working-directory: packages/utopia_database_adapter_mariadb/

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_mariadb_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
environment: pub.dev
working-directory: utopia_database_adapter_mariadb/
working-directory: packages/utopia_database_adapter_mariadb/
2 changes: 1 addition & 1 deletion .github/workflows/publish_utopia_database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
environment: pub.dev
working-directory: utopia_database/
working-directory: packages/utopia_database/
8 changes: 4 additions & 4 deletions utopia_database/README.md → README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Utopia Database

Utopia Database is light and fast database library for Dart. It is designed to be simple and easy to use. It currently supports only MariaDB and MySQL databases.
Utopia Database is light and fast database library for Dart. It is designed to be simple and easy to use. It currently supports only MariaDB database.

## Getting started

Add the following to your `pubspec.yaml` file:

```yaml
dependencies:
utopia_database: ^0.2.0
utopia_database_adapter_mariadb: ^0.2.0
utopia_database: <latest>
utopia_database_adapter_mariadb: <latest>
```
## Usage
Expand Down Expand Up @@ -62,4 +62,4 @@ void main() async {

## Contribute new adapter

To add new adapter for different database, follow the steps in [add database adapter](docs/add_database_adapter.md).
To add new adapter for different database, follow the steps in [add database adapter](/utopia_database/doc/add_database_adapter.md).
3 changes: 1 addition & 2 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: utopia_database_melos

packages:
- utopia_database/
- utopia_database_adapter_mariadb/
- packages/**
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions packages/utopia_database/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## 0.3.0

- Moved MariaDB adapter tests to its own package `utopia_database_adapter_mariadb`
- Thus removed cyclic dependency between `utopia_database` and `utopia_database_adapter_mariadb`

## 0.2.0

- Move MariaDB adapter to its own package `utopia_database_adapter_mariadb`


## 0.1.1

- update documentation comments

## 0.1.0

- Initial version
File renamed without changes.
60 changes: 60 additions & 0 deletions packages/utopia_database/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Utopia Database

Utopia Database is light and fast database library for Dart. It is designed to be simple and easy to use. It currently supports only MariaDB database but you can contribute to [add adapters to other databases](doc/add_database_adapter.md).

## Setup

Together with this package, you need to also add a database adapter package to your project. Check out [MariaDB adapter package](https://pub.dev/packages/utopia_database_adapter_mariadb).


## Example

```dart
import 'package:utopia_database/utopia_database.dart';
import 'package:utopia_database_adapter_mariadb/utopia_database_adapter_mariadb.dart';
void main() async {
final mariadb = await MariaDB.init(
host: 'localhost', port: 3306, user: 'user', password: 'password');
final database = Database(mariadb);
print('connection initialized');
database.setDefaultDatabase('applications');
database.setNamespace('_myproject');
final exists = await database.exists(collection: Database.metadata);
if (!exists) {
await database.create();
print('metadata created');
}
final userExists = await database.exists(collection: 'users');
if (!userExists) {
await database.createCollection('users', [
Attribute(
id: 'name',
type: Database.varString,
isRequired: true,
size: 255,
),
Attribute(
id: 'email',
type: Database.varString,
isRequired: true,
size: 255,
),
Attribute(
id: 'description',
type: Database.varString,
isRequired: true,
size: 2550,
),
], []);
print('users collection created');
}
}
```

## Contribute new adapter

To add new adapter for different database, follow the steps in [add database adapter](docs/add_database_adapter.md).
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Every database adapter is a separate package. To create a adapter for new databa

## Create package

Fork the repository and clone it to your local machine. Then create a new Dart package using the following command.

The naming pattern for the database adapter package is `utopia_database_adapter_<database_name>`. For example, the MariaDB adapter package is `utopia_database_adapter_mariadb`.

```bash
Expand All @@ -28,5 +30,3 @@ class <DatabaseName> extends Adapter {
// implement the abstract methods
}
```

> If you want the adapter to be a part of utopia-dart ecosystem, please raise a issue and share your repo URL and we will review and create a repo under utopia-dart organization.
9 changes: 9 additions & 0 deletions packages/utopia_database/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: utopia_database_example

environment:
sdk: '>=3.0.0 <4.0.0'


dependencies:
utopia_database: ^0.2.0
utopia_database_adapter_mariadb: ^0.2.0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// Support for doing something awesome.
///
/// More dartdocs go here.
/// Utopia Database is light and fast database library for Dart.
/// It is designed to be simple and easy to use.
library utopia_database;

export 'src/adapter.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: utopia_database
description: A light and easy to get started database library for all your Dart projects
version: 0.2.0
repository: https://github.com/utopia-dart/utopia_database
version: 0.3.0
repository: https://github.com/utopia-dart/utopia_database/tree/main/packages/utopia_database

environment:
sdk: '>=2.19.6 <4.0.0'

dev_dependencies:
lints: ^3.0.0
test: ^1.25.2
utopia_database_adapter_mariadb: ">=0.2.0 <1.0.0"


dependencies:
collection: ^1.17.1
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.0

- Added integration test for databsae adapter

## 0.2.0

- Update dependencies
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

MariaDB adapter for [Utopia database](https://github.com/utopia-dart/utopia_database).

## Getting started
## Setup

This package should be used along with [utopia_database](https://pub.dev/packages/utopia_database) package to connect to MariaDB database.

```yaml
dependencies:
utopia_database:
utopia_database_adapter_mariadb:
```

Then in `main.dart` you can
## Example

```dart
import 'package:utopia_database/utopia_database.dart';
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions packages/utopia_database_adapter_mariadb/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: utopia_database_adapter_mariadb
description: MariaDB adapter for Utopia database library, that connects to MariaDB to provide database functionalities.
version: 0.3.0
repository: https://github.com/utopia-dart/utopia_database/tree/main/packages/utopia_database_adapter_mariadb

environment:
sdk: '>=2.19.6 <4.0.0'

dependencies:
mysql1: ^0.20.0
utopia_database: '>=0.2.0 <1.0.0'

dev_dependencies:
lints: ^3.0.0
test: ^1.24.0
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: utopia_database_melos
publish_to: none

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down
12 changes: 0 additions & 12 deletions utopia_database/CHANGELOG.md

This file was deleted.

31 changes: 0 additions & 31 deletions utopia_database/docker-compose-local.yml

This file was deleted.

15 changes: 0 additions & 15 deletions utopia_database_adapter_mariadb/pubspec.yaml

This file was deleted.

0 comments on commit 7aa7a8b

Please sign in to comment.