Commit Graph

36 Commits

Author SHA1 Message Date
Sean Griffin
b136f2c4b0 Make sure Travis uses an up to date version of sqlite
I have no clue why this changes based on the value of `sudo: required`.
Without it, Travis uses 3.7. With it, Travis uses 3.8.

Fixes #167
2016-02-03 06:58:25 -07:00
Sean Griffin
17f4b8d487 Setup travis in a way that doesn't use ancient SQLite versions
The version that is in the container infrastructure is from 2011. We use
`sqlite3_errstr` which was added in 2012. The switch to the "trusty"
infratstructure bumps it to 3.8, which is relatively recent.

This exposes a legitimate bug related to nul bytes in string fields that
for some reason not replicating for me locally.
2016-02-03 06:58:24 -07:00
Sean Griffin
17a3034bcd Initial SQLite support
This commit adds all of the guts for SQLite3 support to Diesel. There
are several outstanding issues which will need to be resolved before
this is ready to be merged into master. This commit will not be merged
into master until these issues have been resolved.

Ultimately the most difficult remaining problem which we need to address
is the lack of a `DEFAULT` keyword. I will detail why this is a problem
and what I think we can do to solve it in a separate issue.

SQLite has a fundamentally different mechanism for handling bind
parameters than pretty much every other backend out there, where the
function you call differs based on the type, rather than sending an
array of bytes and telling the backend how to interpret it. `FromSql`
had to be updated to address this (see
8a33029944
for details on that). I have not applied the same change to `ToSql`, as
it was possible to shoehorn SQLite into our existing structure. While
this may end up changing in the future, I do not believe it is necessary
for 0.5.

I'm not super happy about the structure of `StatementIterator`,
`SqliteRow`, and `SqliteValue`, as ultimately the `Row` is a giant lie
and `Statement` is the the value that maintains all of the state.
Ultimately this comes out of the weird interaction between the fact that
`Row#take` returns a reference, but sqlite's C api doesn't actually
return a single value that works in that sense (and really doesn't have
the concept of a row at all). As with much of our code overall, this can
probably be cleaned up in the future by having the `Backend::RawValue`
directly be a reference for `Pg`. I need to figure out a way to
accomplish this without adding a lifetime to the `Pg` struct.

I've broken our test suite into postgres specific and general where
possible, but this is a *very* incomplete process. There are several
modules which are entirely scoped to PG that do not need to be, which
can be addressed independently in later PRs. Additionally, the entire
`expression` module needs to be for expressions which are specific to
PG. I do not believe that SQLite has anything specific to it which is
not also supported by PG.

Fixes #39 (mostly. Enough to close the issue at least)
2016-02-03 06:58:24 -07:00
Sean Griffin
eaffa53d1a Run diesel_cli tests on Travis 2016-02-02 15:15:07 -07:00
Mike Piccolo
5271d8b70b Fix compile fail tests 2016-01-24 19:13:52 -08:00
Sean Griffin
106bcc5a97 Run codegen's tests on CI
These tests were broken by https://github.com/sgrif/diesel/pull/103, but
the tests aren't run on Travis currently
2016-01-18 10:37:43 -07:00
Sean Griffin
07a7e3f877 Update the travis webhook URL (the other doesn't appear to be working)
It's possible the blank line was the problem as well
2016-01-18 10:35:36 -07:00
Sean Griffin
81e5b891d8 Add Travis notifications to the contributors gitter room 2016-01-18 10:22:16 -07:00
Mike Piccolo
53e8c8b494 Bump syntax, quasi and aster. 2016-01-16 20:10:46 -08:00
Sean Griffin
f867947093 Correctly pass cargo arguments on travis
When in doubt, MOAR DASHES
2016-01-15 11:43:25 -07:00
Sean Griffin
6d424d11a4 Improve our test coverage for our time types
The first attempt at adding support for `chrono::NaiveDate` was
completely incorrect. This was in part due to the fact that I never
tested for some known values. Combined with the fact that I've
discovered quickcheck is testing a much smaller set of values than I
thought (which would likely expose some bugs), I wanted to make sure
that our existing tests for real values are at least valid.

The quickcheck tests need to eventually be updated, as `PgDate` will not
in fact round trip for values below -200000ish (earlier than Julian
era), it will silently insert null.
2016-01-15 11:37:47 -07:00
Matt Casper
7a49609986 Remove DATABASE_URL_FOR_SCHEMA from .travis.yml
This env var doesn't seem to be used in tests anymore, so we shouldn't
need it in travis.
2016-01-10 23:10:23 -08:00
Sean Griffin
d75f9483fb Upload docs when stable passes, not nightly
The latest nightly is currently failing due to the `rand` crate, and
there's really not much I can do about it at the moment. Since `nightly`
is an allowed failure, we'll ship when stable passes instead.
2016-01-08 14:55:15 -07:00
Sean Griffin
3d49369176 It's 2016.
This took me embarassingly long to figure out.
2016-01-07 12:57:42 -07:00
Sean Griffin
06d878e908 Bump known working nightly version
There were upstream changes in rustc, which have been resolved in aster,
quasi, etc, but the versions that will resolve as it is no longer build
on 2015-12-30
2016-01-07 06:57:29 -07:00
Mike Piccolo
48c19ee2e7 Use most recent nightly build 2015-12-31 12:47:33 -08:00
Sean Griffin
7a42d4d91f Fix build on nightly
Close #67
2015-12-25 11:53:07 -07:00
Matt Casper
fe9067387f Update nightly build (that can't fail) to today 2015-12-08 20:05:18 -08:00
Sean Griffin
a4a7bc2df6 travis-cargo doesn't pass --features unstable on nightly-date for us 2015-12-06 07:59:31 -06:00
Sean Griffin
6e3c551c40 That's not how shell works 2015-12-06 07:55:41 -06:00
Sean Griffin
63013a17e1 Test nightly build on nightly-date versions 2015-12-06 07:51:16 -06:00
Sean Griffin
c3b157e321 Add last known supported nightly to the matrix 2015-12-06 07:45:43 -06:00
Mike Piccolo
88bba7de1a Swing and a miss on first travis config. 2015-12-05 16:01:24 -08:00
Mike Piccolo
35c6021d05 Allow failures on travis nightly 2015-12-05 15:43:45 -08:00
Sean Griffin
446c7e3a1f First pass at schema inference
This macro takes a database connection at compile time, inquires about
the schema, and invoke the `table!` macro for you automatically. This is
an early pass, and it doesn't support any types from third party crates,
or custom primary keys (I'm not even 100% sure that it won't error some
of the time on types that we do support).

Right now we're going off of the type name and capitalizing it to find
the right type. I'm unsure if we'd be better off using the OID (and then
the aliases would be `Oid6342 = Array<Json>` or whatever). We do need to
decide that before 1.0, as it'll be a breaking change for third party
crates.

I've had to do some funkiness in our tests, where basically I set up the
schema on a separate database from where our tests run. This is because
our suite assumes that we can rely on the id 1, which means the table
has to be created in that test. I cannot drop the tables before the
tests run, because on nightly I don't have a place to execute code after
compilation finishes.

As such, this doesn't actually make our tests look much cleaner, but
once we refactor to work w/ persistenct schema we should be able to
remove a lot of code.
2015-12-04 16:16:38 -07:00
Sean Griffin
991edd9cac Only build travis on master
For some reason the build badge uses *all* branches and not just master.
I can't remember if this fucks with PRs or not, but we'll find out
2015-12-03 14:23:44 -07:00
Sean Griffin
af8daade8f I should probably tell Travis about the new name 2015-11-29 10:46:53 -07:00
Sean Griffin
b4fed34c69 Update the travis build to work on nightly
We need to exclude default features when `unstable` is included, or
we'll end up having syntex in codegen, but trying to use rustc_plugin
from tests
2015-11-28 15:22:54 -07:00
Sean Griffin
1ba9053c61 Get the build working on stable and beta
This introduces syntex as a dependency on stable, which will pre-process
the appropriate files for annotations. We need to document this process
somewhere.

Fixes #15
2015-11-28 14:23:04 -07:00
Sean Griffin
6f999b7123 We need to build the docs to upload them
I wish I could do this on a branch...
2015-11-28 12:46:12 -07:00
Sean Griffin
954a2d9724 Actually give travis the ability to upload docs 2015-11-28 12:41:21 -07:00
Sean Griffin
a7caa2faf9 Upload docs from travis 2015-11-28 12:32:35 -07:00
Sean Griffin
dd3c68c374 Get travis up and running, on the latest nightly
Wow, so apparently we don't built on stable or beta, not because of the
compiler plugins, but because `For<i32> for i64` isn't on stable, and
`For<i32> for f64` is only on nightly. Additionally, there was a
breaking change in compiler plugins *tonight*, which I've updated for
(and am pointing at a local branch for dependencies until it gets fixed
upstream).

Sorry for the breakage folks, I know it's a pain. Update to tonights
nightly, it's now the only thing we work on, because I don't know how to
make travis go to last nights. We'll be on stable by the end of the
week.
2015-11-27 16:52:40 -07:00
Sean Griffin
8da8b17ca3 Apparently we don't build on stable
Ok, I mean I knew that our tests wouldn't work yet because I haven't
added syntex, but that's not even the problem. Apparently the *real*
reason we don't work on stable is that `From<i32> for i64` is only
implemented on beta and `From<i32> for f64` is only nightly. I figured
there were reasons I couldn't target stable, but really????
2015-11-27 16:19:04 -07:00
Sean Griffin
cd031ecb8d Actually give travis a valid script
It won't pass, as PG isn't installed and I'm not setting the proper env
vars, but it's a start
2015-11-27 16:13:07 -07:00
Sean Griffin
3b96273339 Add travis 2015-11-26 12:11:57 -07:00